Storage of functions with arguments as String

I need to store a function with arguments in a string.

Without arguments, you simply have to do sth. Like this:

functionName:String = "Hello";

This [FunctionName])

Function Hello (): void {}

"Hello, World";

}

But as soon as you enter arguments it becomes difficult.

I came up with this:

function getArgsFromFunction(_function: String): Array {}

var argstart: int = _function.indexOf ("("); ")

var argend: int = _function.indexOf ("") ");"

var argstring: String = _function.substr (argstart + 1, argend - argstart - 1);

var args: Array = argstring.split(",");

Return args;

}

function getNameFromFunction(_function: String): String {}

var nameEnd: int = _function.indexOf ("("); ")

"stringname" var: String = _function.substr (0, nameEnd);

return "stringname";

}

var f: String = "showMessage (A, B)";

function showMessage(_args: Array): void {}

trace (_args);

}

var _funct: function = this [getNameFromFunction (f)];

_funct. Call (this, getArgsFromFunction (f));


but it is not very flexible, very sturdy and seems unnecessarily complicated.

Anyone know a faster way to achieve this?

function parseF(s:String):void {}

var a: Array = s.split ("("); ")

var arg:Array = a [1].split(",");

This [a [0]] (arg [0], arg [1] .substr (0, -1));

}

Tags: Adobe Animate

Similar Questions

  • a reminder of the user interface will have a function with arguments?

    some ScriptUI quirks... I have a function (cut in this example) that I can call very well by itself of the extendScript window or if I set directly to the onClick callback, but when I try and call the function from a reminder and analyze arguments, the onClick is not working and the service runs once when the script runs first? what I am doing wrong?

    It works using the extend script window

    Nudge (23,77)


    function nudge (offset, distance) {}

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (shift * distance);

    Alert ("Done")

    }

    This works when the button is clicked in the user interface


    myButton.onClick = function() {

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (23 * 77);

    alert("done")

    }

    This also works when the button is clicked in the user interface


    myButton.onClick = boost


    function nudge() {

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (23 * 77);

    alert("done")

    }

    but when I try and pass arguments (kind of functions) that does not


    myButton.onClick = nudge (23,77)


    function nudge (offset, distance) {}

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (shift * distance);

    Alert ("Done")

    }

    OK, in the case where someone is interested... the solution with the permission of Mr. Lloyd Alvarez is to nest the function in another function call, why, I have no idea, but it works a treat...

    myButton.onClick = function() {nudge (23,77)}

    function nudge (offset, distance) {}

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (shift * distance);

    Alert ("Done")

    }

  • How to call the function with arguments varray.

    Hello
    I've got function like this:
    CREATE OR REPLACE
    TYPE VARR_VARCHAR AS VARRAY(256) OF NVARCHAR2(500)
    /
    
    CREATE OR REPLACE
    TYPE E_VARR_VARCHAR AS VARRAY(256) OF nVARCHAR2(4096)
    /
    
    FUNCTION find_id(
          p_id            IN   VARCHAR2,
          p_special_columns     IN   varr_varchar,
          p_special_values      IN   e_varr_varchar,
         )
          RETURN VARCHAR2;
    How can I build this function call (nvarchar data type is necessary) using the only pl/sql and can do with pure as sql select double f();?
    I'm on 9.2.0.8.
    Concerning
    GregG

    Select find_id (p_id, VARR_VARCHAR('1','2','3'), e_varr_varchar('1','2','3')) of double;

    -sty.

  • Call the function with the arguments in AS3

    Hello!
    I am a new in Flex development and cannot understand same code convention, im Java programmer.
    How I can write correct function in ActionScript, my call call: var goodsWnd:CreateGoodsWindow = PopUpManager.createPopUp (this, CreateGoodsWindow, true) as CreateGoodsWindow;
    I want call above function with argument, how do?
    Where my class: public class CreateGoodsWindow extends extends TitleWindow
    {
    public CreateGoodsWindow(data:Object)
    {....}
    }

    Using PopUpManager.addPopUp () instead of of createPopUp(). addPopUp takes an object that has already been instantiated:

    var createGoodsWindow:CreateGoodsWindow = new CreateGoodsWindow (data);
    PopUpManager.addPopUp (createGoodsWindow);

  • CSXSInterface: Call to jsx-function with a string xml as parameter?

    Hello

    for me CSXSInterface worked very well so far with all the settings and the SyncResults.

    Now, I do a few operations xml with actionscript 3 and photoshop scripts. I am able to return an XML from a function javascript to actionscript3 and do all kinds of operations with it. Somehow, I can't call a function with the string xml as parameter jsx? Does anyone have a solution for this?

    Here is what I tried:

    var xmlStr:String = _myXml.toXMLString(); // I tried _myXml.toString() too but it didnt work either ;-(
    CSXSInterface.instance.evalScript("xmlFunction", xmlStr);
    
    

    Thanks in advance!

    Not for me it isn't...

    I use Flash Builder (with Extension Builder added on) too, and I don't remember having seen a mistake HostObject of any kind. Import you the classes necessary?

    Substances

  • Problem with scanning chips string token

    Hi, I use the string scanning for token read in a string of tokens that contain key "*" char in front of each string and ends when the token index = - 2. It works fine if I said * 12345 * 1234 and so forth, but if there is incorrect data, say 1234 the leaderless ' * ' in front, the return value token index is always-1 and it returns the data I read thinking that there the «*» Maybe I shouldn't use the string for the symbolic function since it is probably intended just for the chips to end and not data with tokens. Is there a way to make this work, or should I use another method to search for tokens in a string?

    Thank you.

    Here try this one.  He did the same thing and exposed uses functions.

    The string functions look for something mark the end of a string.  All languages that I know to do it.  So, as I said, delete the first element.  I recommend the subarray with the index value 1 function and length thread continues.

  • External function with a pointer to a callback within a DLL function

    Hello.

    I am loading a DLL and try to call a function with the following prototype:

    Func1(HANDLE, hHandle, LPVOID (*pCallback)(UINT, UINT LPVOID), CHAR* sPath)
    

    Now, I have no problem with the types of variables, because CVI 9.0.1 recognizes each of them and I have no problem with LoadLibrary() and GetProcAddress().

    But, how to pass a pointer to a callback function that is inside the DLL, I am trying to use.

    I tried to declare the callback like this:

    LPVOID (CALLBACK Callback)(UINT iDevNo, UINT evEvent, LPVOID pData);
    

    and call the Func1 function like this:

    (Func1)(hHandle, &Callback, NULL);
    

    but it irritates me:

    Symbol not defined "_Callback@12" referenced in "source.c.

    Hopefully I can help.

    I appreciate your time on this issue.

    Kind regards.

    Hi Daniel,.

    He must first make sure that the callback function is exported by the DLL, so the program that uses the DLL can access the identifier of the function name. Then you must make sure that you call GetProcAddress not only on Func1, but also on the exported callback function. You must store the two address function values in their respective function pointers. You can then pass the pointer to callback in the form of argument to the call to Func1.

    It's probably cleaner if you set of typedefs for all your function pointers, in the calling program:

    typedef LPVOID (__stdcall * CallbackType) (UINT, UINT, LPVOID);
    typedef? (__stdcall * Func1Type) (HANDLE, hHandle CallbackType, CHAR *);

    ...

    CallbackType CallbackPtr;
    Func1Type Func1Ptr;

    ...

    dllHandle = LoadLibrary ("... ») ;
    CallbackPtr = (CallbackType) GetProcAddress (dllHandle, 'Callback');
    Func1Ptr = (Func1Type) GetProcAddress (dllHandle, "Func1");

    ...

    Func1Ptr (..., hHandle, CallbackPtr, NULL);

    Boa kind!

    Luis

  • Why the function of integrated separator string is missing in Oracle?

    Hi all

    It's maybe a generic/discussion question. And it's purely for learning about how Oracle prioritizes its development on the functions in construction.

    Well, we have very userful built-in functions (http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions001.htm) is transformed during the versions of Oracle from simple to very complex (syntactic xml and data mining functions)

    But why is this important function to split a string has been neglected (may not be the right word) by Oracle.

    Be a learner curious and admirer of such a wonderful technology database called Oracle, I always thought that it must have a dedicated channel, divide the function.

    My question is: is this something that can be generalized in a built-in function?

    or

    Is he coming releases?

    At least a simple function first (I guessed right his name would be splitstr and the very basic features to do our job of splitting, maybe I'm wrong in thinking this way, please correct me if...) Thank you in advance!)

    splitstr('A,B,c',',','col')-> (separator ',' and the fractionating column mode)

    Output: A B C (three separate columns)

    splitstr('A,B,c',',','row')-> (separator ',' and the mode line split)

    Output:

    A

    B

    C

    ----------

    If oracle has this, there will be a lot of code reduced and we can be saved by connect or recursive with clause or as a matter of fact even xmltable (with or without tokenizer ) for the separation of the channels.

    What you have to say about this? You can ignore this naïve question if is not a value you answer.

    And thanks for everyone who reads this discussion!

    See you soon,.

    Manik.

    Can you please help me understand why Oracle has its participation in develping and DBMS_UTILITY.COMMA_TO_TABLE now then?

    http://docs.Oracle.com/CD/B19306_01/AppDev.102/b14258/d_util.htm

    Oracle can only tell you why they have developed this particular function. But the fact that Oracle included in a package of "utility" tells me that they do not consider that there was a generic number of use cases. These functions often begin as internal functions that Oracle decides to publish.

    But if you read this API spec you'll see that he does that to a VERY PARTICULAR use case and has several restrictions.

    The list must be a list separated by commas of non-vide: another thing that a comma-separated list is rejected. Do not count the commas inside double quotes.

    Entries in the list separated by commas may not include multibyte and dashes (-) character.

    Also, returns a collection which would normally be used only for a very limited number of items.

    It is not yet near a general-purpose function.

    A major complication with such a function in SQL is sql is generally used with more than one, or even millions, of lines.

    How you specify to Oracle where to put the collection on each of these lines?

    New - Oracle is a relational database. With the help of sql to manipulate collections is NOT a relational paradigm.

    Just my opinion. Others can and will disagree. But you may have to wait for the weekend for these answers.

  • How can I call a function with parameter out of sql

    Hello world
    I'm calling a Sql statement function and I get this error ORA-06572: XX function has arguments.

    can you offer any solution on this workaround.

    Thank you

    Hello

    Sorry, you cannot call functions with OUT arguments (or arguments, but I'll just say in the future) SQL statements.
    This is one of the reasons why many people avoid having arguments in functions.
    THE arguments are never optional. If the function expected of them, you must pass to them.

    Depending on your needs, you can write a Wrapper function that has no arguments.
    For example, if you want to call this function:

    fun1 ( in_out_str      IN OUT  VARCHAR2
         , in_num          IN      NUMBER
         )
    RETURN  NUMBER ...
    

    you don't need really the value changed to in_out_str, then you can write a function like this:

    fun1_wrapper ( in_str          IN      VARCHAR2
                   , in_num          IN      NUMBER
                   )
    RETURN  NUMBER
    IS
        in_str2     VARCHAR2 (32767)  := in_str;
    BEGIN
        RETURN  fun1 ( in_str2
                       , in_num
               );
    END  fun1_wrapper;
    

    You can use fun1_wrapper in a SQL statement, even if you cannot use fun1 in the same statement.

    Published by: Frank Kulash on February 27, 2013 09:42

  • perform an immediate function with parameter out

    How to perform a function with parameter in the statement immediately execute?
    declare
       vRunFunctie   varchar2(100) := 'startfunction';
       vParmIn1      varchar2(100) := 'AAA';
       vParmIn2      varchar2(100) := 'HHH';
       vParmOut1     number;
       vParmOut2     varchar2(100);
    begin
       --
       execute immediate 'select '||vRunFunctie||'('''||vParmIn1||''','''||vParmIn2||''',:vParmOut2) from dual' into vParmOut1 using vParmOut2;
       --
       dbms_output.put_line('vParmOut1['||vParmOut1||']');
       dbms_output.put_line('vParmOut2['||vParmOut2||']');
    end;
    /
    error: ORA-06572 startfunction function has arguments

    the statement looks like this in pl/sql:
    vParmOut1 := startfunction(vParmIn1, vParmIn2, vParmOut2);
    --vParmOut1 := startfunction('AAA', 'HHH', vParmOut2);
    Thank you.
    L.

    Update:
    You are not using bind variables with your dynamic code. That is a major mistake and the #1 reason for poor database performance.
    It is a fundamental flaw in programming to design a function that includes output parameters. This is simply and plainly wrong.
    Output parameters are also not supported by the SQL language - it does not support "procedure" like code units and call methods. 
    I know that the function should not have out parameters. But its programmed that way already...

    You try something like

    declare
       vRunFunctie   varchar2(100) := 'startfunction';
       vParmIn1      varchar2(100) := 'AAA';
       vParmIn2      varchar2(100) := 'HHH';
       vParmOut1     number;
       vParmOut2     varchar2(100);
    begin
       --
       execute immediate 'begin :x := ' || vRunFunctie || '( :p1,  :p2, :vParmOut2 ); end;' using out vParmOut1, vParmIn1, vParmIn2, out vParmOut2;
       --
       dbms_output.put_line('vParmOut1['||vParmOut1||']');
       dbms_output.put_line('vParmOut2['||vParmOut2||']');
    end;
    / 
    
  • PL/SQL-function with variable number of parameters

    Hello

    I want to write an INLIKE function that combines the functions of the po and AS operator.
    I want to call it that:

    SELECT 1 in the table where INLIKE (column, Motif1, pattern2,...) with a variable count of bosses.

    Is there a possibility the java selection button (String... stringArray) to declare or to make, I have to define a function with multiple parameters and default values?

    With greetings

    Florian

    You don't need to write a function no., you can use regular expressions REGEXP_LIKE...

    for example to find all the rows that have % ED % or % LY in them...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'FRED IS SCARED' as txt from dual union all
      2             select 'EDWARD IS HAPPY' from dual union all
      3             select 'BOB AND TIM ARE ASLEEP' from dual union all
      4             select 'JIM AND SALLY DO NOT CARE' from dual)
      5  --
      6  -- END OF TEST DATA
      7  --
      8  select *
      9  from t
     10* where regexp_like(txt, '(ED|LY)')
    SQL> /
    
    TXT
    -------------------------
    FRED IS SCARED
    EDWARD IS HAPPY
    JIM AND SALLY DO NOT CARE
    
  • Mathematical functions with input/output error

    Please refer to the attached picture. Where do you find these mathematical functions with input/output error? I saw these in response to a message.

    I think they appear when you connect a waveform or dynamic data type.  Since I rarely use these data types (just give the table!), I'm not positive.

    Lynn

  • InDesign CS5 for windows only allow me to scroll through the functions with the mouse wheel

    Nice day

    InDesign CS5 for Windows only allow me to scroll through the functions with the mouse wheel and for example not allow me to access drop down menus, any help will be much appreciated

    https://helpx.Adobe.com/InDesign/KB/InDesign-tools-panels-Don ' t - respond.html

  • MAF: REMOTE URL function with the "BACK" button?

    Hello Oracle Community:

    I create the mobile functionality with ability to feature remote "URL".  How can I find my App after loading a remote URL feature?  It seems that transfers control outside of the mobile app and I can't get into my application.

    Please notify.

    TreeStrepek

    The remote URL feature of the MAF is designed so that if you open a remote URL to the MAF that is not in the whitelist of your application, the site opens in the browser of the device (iOS, Chrome).  If the URL is added to the white list, then an online browser opens the page * in * MAF.

    What you describe, it seems that you touch the first case, when you say "It seems that this transfers control outside of the mobile app and I can't get into my application."  By default, the URL that you set in a remote URL is automatically added to the whitelist, but if the user then visits a URL from the URL to a distance which is not in the whitelist, then the page will open in the browser on the device.

    Also, when you set a remote URL, note on the MAF-"Happy" feature.xml page there is a box titled 'show the Browser Navigation buttons'.

    CM.

  • You can have two stored functions with the same name?

    Hi all

    You can have two stored functions with the same name?

    My version of DB - connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0

    Thank you.

    You can have the same name as long as they are within a package and with different parameters

    create or replace package test_pkg

    as

    function my_func (p1 in number)

    return number;

    function my_func (at number p1, p2)

    return number;

    end test_pkg;

    /

    create or replace package body test_pkg

    as

    function my_func (p1 in number)

    Return number

    as

    Start

    return 0;

    end;

    function my_func (at number p1, p2)

    Return number

    as

    Start

    return 0;

    end;

    end test_pkg;

    /

Maybe you are looking for

  • Assign the carrier on iPhone sim free

    Hi, I hope someone can help DESCRIPTION OF THE PROBLEM: I bought iPhone sim free 6s to Wal-Mart in the United States, recently, but planned to use in foreign carriers. When you pay at Walmart, asked me what phone carrier will be used on? But since I

  • HP Pavilion 500-319na: hp pavilion 500-319na

    Hi there are people I brought this PC as a quick purchase to start the game, but now I suffer for my mistake and I need to Exchange my old 705 gt (which came with it) for a model more high that will fit in my case I already tried a nvidia GTX 970 but

  • Internal analysis based on the error Code 7

    I am trying to create the Setup program for one of my application and got stuck with deployment error. Build state indicates as follows From a newspaper for the deployment. Based on the analysis Analysis completed Error code internal 7 analysis of de

  • Support the T61 SATA 3 GB of HARD drive?

    Hello: I want to install a new HDD with SATA 3 Gb. If it build on my T61 7658 CTO? Will there be a difference in performance against a similar HDD with SATA 1.5 Gb? Thank you RC

  • easy transfer error message

    I am running windows xp media center sp3 and am trying to transfer files to the new computer windows 7 with easy transfer program.  I get "" you are currently connected using a temporary profile.  Restart your computer and try again. "Help, please!