How to get each character in a string

as in 'C' we use arrays to get each character of a string stored in array.how can we get each character of a string stored in a variable.

Hi,
For that you need to do offset.
for example one variable called VAR contains string 'HUMERAH'.
if you want each character of that string then you need to decalre as many variable as the number of string.
like
data : var1(1),
         var2(1),
var(3),
var(4).
var1 = var+(1).
var2 = var+1(1).
var3 = var+2(1).
var4 = var+3(1).
now var1,var2,var3,var4. contains the single characters.
Regards,
Guru
mark helpful answers

Similar Messages

  • How to get specific character from a string

    I have a value such as: 0-5 or 123-30. This is a combination
    from 2 different IDs.
    All I need is to get the number on the right (5 from 0-5 OR
    30 from 123), any number on the right of the "-" character not
    including
    the "-"
    I'm not sure what ColdFusion function can I use safely.
    I said safely since all I can find is either Left or Right
    functions. With these 2 functions, I need to specify the number of
    character to extract while in my case the application is growing so
    the ID may currently be only 1 digit each (0-5) but later it may
    grow longer (123-5677).
    If anyone know the function, please help me. Thank you!

    Something like this?
    Mid(string, Find("-",string)+1 ,
    Len(string)-Find("-",string))
    Since
    Mid(string, start, count)
    and
    Len(string or binary object)
    and
    Find(substring, string [, start ])
    Or perhaps ....
    ListLast(string, "-")
    since
    ListLast(list [, delimiters ])
    Phil

  • How to get each value from a parameter passed like this '(25,23,35,1)'

    Hi
    One of the parameter passed to the function is
    FUNCTION f_main_facility(pi_flag_codes VARCHAR2) return gc_result_set AS
    pi_flag_codes will be passed a value in this way '(25,23,35,1)'
    How to get each value from the string
    like 25 first time
    23 second time
    35 third time
    1 fourth time
    I need to build a select query with each value as shown below:-
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3, code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 25 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q1,
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3,code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 23 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q2,
    (SELECT t2.org_id, RTRIM(xmlagg(xmlelement(e, t4.description || ';')
    ORDER BY t4.description).EXTRACT('//text()'), ';') AS DESCRIPTION
    from org_name t2, ref_org_name t3,code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 35 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date
    group by t2.org_id) q3,
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3, code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 1 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q4
    Please help me with extracting each alue from the parm '(25,23,35,1)' for the above purpose. Thank You.

    chris227 wrote:
    I would propose the usage of regexp for readibiliy purposes and only in the case if this doesnt perform well, look at solutions using substr etc.
    select
    regexp_substr( '(25,23,35,1)', '\d+', 1, 1) s1
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 2) s2
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 3) s3
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 4) s4
    from dual 
    S1     S2     S3     S4
    "25"     "23"     "35"     "1"In pl/sql you do something like l_val:= regexp_substr( '(25,23,35,1)', '\d+', 1, 1);
    If t2.att_type is type of number you will do:
    t2.att_type= to_number(regexp_substr( '(25,23,35,1)', '\d+', 1, 1))Edited by: chris227 on 01.03.2013 08:00Sir,
    I am using oracle 10g.
    In the process of getting each number from the parm '(25,23,35,1)' , I also need the position of the number
    say 25 is at 1 position.
    23 is at 2
    35 is at 3
    1 is at 4.
    the reason I need that is when I build seperate select for each value, I need to add the query number at the end of the select query.
    Please see the code I wrote for it, But the select query is having error:-
    BEGIN
    IF(pi_flag_codes IS NOT NULL) THEN
    SELECT length(V_CNT) - length(replace(V_CNT,',','')) FROM+ ----> the compiler gives an error for this select query : PLS-00428:
    *(SELECT '(25,23,35,1)' V_CNT  FROM dual);*
    DBMS_OUTPUT.PUT_LINE(V_CNT);
    -- V_CNT := 3;
    FOR L_CNT IN 0..V_CNT LOOP
    if L_CNT=0 then
    V_S_POS:=1;
    V_E_POS:=instr(pi_flag_codes, ',', 1, 1)-1;
    else
    V_S_POS:=instr(pi_flag_codes,',',1,L_CNT)+1;
    V_E_POS:=instr(pi_flag_codes, ',', 1, L_CNT+1)-V_S_POS;
    end if;
    if L_CNT=V_CNT then
    V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS));
    else
    V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS,V_E_POS));
    end if;
    VN_ATYPE := ' t2.att_type = ' || V_ID;
    rec_count := rec_count +1;
    query_no := 'Q' || rec_count;
    Pls help me with fetching each value to build the where cond of the select query along with the query number.
    Thank You.

  • How to select each character of column value

    Hi All,
    How can i get each character separately of a column value in a select statement.
    LIKE i emp table if ename='Test' then i want
    a select statement that can give me the result like this
    T,e,s,t
    Regards,
    Anil R

    or this?
    SQL> create table mytable
      2  as
      3  select 'test' text from dual union all
      4  select 'a text, containing two comma''s (,)' from dual union all
      5  select 'a text ending with a comma,' from dual
      6  /
    Tabel is aangemaakt.
    SQL> select text
      2       , substr(regexp_replace(text,'(*?)',',\1'),2,length(text)*2-1) with_commas
      3    from mytable
      4  /
    TEXT                               WITH_COMMAS
    test                               t,e,s,t
    a text, containing two comma's (,) a, ,t,e,x,t,,, ,c,o,n,t,a,i,n,i,n,g, ,t,w,o, ,c,o,m,m,a,',s, ,(,,,)
    a text ending with a comma,        a, ,t,e,x,t, ,e,n,d,i,n,g, ,w,i,t,h, ,a, ,c,o,m,m,a,,
    3 rijen zijn geselecteerd.Regards,
    Rob.
    Message was edited by:
    Rob van Wijk
    Slight modification to cater for strings beginning and ending with commas.

  • How to get each node in tree?

    how to get each node in tree?
    Message was edited by:
    NikisinProblem

    how to get each node in tree?
    Since (as far as I know) treeNode is an interface, the real question to me is how are you implementing your treeNodes? Are you overriding the toString() method?

  • How to get each thread in the threadpool

    Hi,everyone.I'm now learning java.util.concurrent package and I have two questions about the threadpool.
    1) How to get each thread in the threadpool;
    2) How to get each thread's data in the threadpool and dispaly them onto GUI;
    e.g :
    There are 5 threads in the threadpool(ThreadPoolExecutor) and I have 100 tasks(Runnable or Callable),every task scans a directory(every task scans a different directory),how can I display the "real-time" count of the files in the directory which the current 5 threads in the threadpool scan onto the ListView Items in the GUI?

    Willings wrote:
    Hi,everyone.I'm now learning java.util.concurrent package and I have two questions about the threadpool.
    1) How to get each thread in the threadpool;You don't
    2) How to get each thread's data in the threadpool and dispaly them onto GUI;
    e.g : You don't
    There are 5 threads in the threadpool(ThreadPoolExecutor) and I have 100 tasks(Runnable or Callable),every task scans a directory(every task scans a different directory),how can I display the "real-time" count of the files in the directory which the current 5 threads in the threadpool scan onto the ListView Items in the GUI?You should notify your "monitor" when you add something to the pool, and the Runnable/Callable should notify the same "monitor" when it starts to execute, and during its processing. Finally you notify the monitor when the execution has completed.
    Kaj

  • How to replace a character in a string with blank space.

    Hi,
    How to replace a character in a string with blank space.
    Note:
    I have to change string  CL_DS_1===========CM01 to CL_DS_1               CM01.
    i.e) I have to replace '=' with ' '.
    I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
    Its not working.

    Hi,
    Try with this..
    call method textedit- >replace_all
      exporting
        case_sensitive_mode = case_sensitive_mode
        replace_string = replace_string
        search_string = search_string
        whole_word_mode = whole_word_mode
      changing
        counter = counter
      exceptions
        error_cntl_call_method = 1
        invalid_parameter = 2.
    <b>Parameters</b>      <b> Description</b>    <b> Possible values</b>
    case_sensitive_mode    Upper-/lowercase       false Do not observe (default value)
                                                                       true  Observe
    replace_string                Text to replace the 
                                         occurrences of
                                         SEARCH_STRING
    search_string                 Text to be replaced
    whole_word_mode          Only replace whole words   false Find whole words and                                                                               
    parts of words (default                                                                               
    value)
                                                                               true  Only find whole words
    counter                         Return value specifying how
                                        many times the search string
                                        was replaced
    Regards,
      Jayaram...

  • How to get a char from a String Class?

    How to get a char from a String Class?

    Use charAt(int index), like this for example:
    String s = "Java";
    char c = s.charAt(2);
    System.out.println(c);

  • How to display each character of an input string in different rows

    Dear Members,
    I want to write a SQL or PL/SQL where in I can separate and display each character of an input string into multiple rows.
    For eg, the input string is TESTING, I want the result to be displayed as following:
    1 T
    2 E
    3 S
    4 T
    5 I
    6 N
    7 G
    I know we can use substr, but it returns me only one or more than one characters consecutively.
    Please help me get the desired output.
    Thanks in advance.

    Hi,
    Perhaps
    with a as
    select 'TESTING' text from dual
    select level, substr(a.text,level,1)
    from a
    connect by level <= length(a.text)

  • How to get a position in a string?

    I need to get a position in a string like the word CHEESE, where the c is position 1, the h is position 2, the e is position 3 etc... Which input stream should i use and how does it work really?

    indexOf(int ch)
    Returns the index within a string of the first occurrence of the specified character.

  • How to get the postion of any string

    hi
    like untitle.txt
    how to get the postion of '.'.
    Amit

    Hi Amit,
    Use SEARCH statement to find out a character or a string in a string.
    DATA V_STRING TYPE STRING VALUE 'untitle.txt'.
    SEARCH '.' FOR V_STRING.
    If search is successful then it will return position of character or string into system field SY-FDPOS.
    If your idea is get values of filename and extension by separating period then use simply SPLIT statement.
    SPLIT V_STRING AT '.' INTO V_FILE V_EXT .
    Thanks,
    Vinay
    Edited by: Vinaykumar G on Jul 1, 2008 8:52 PM

  • How to get one character at a specified index and put it in a mutablestring

    I am new in cocoa programing and i am stock.
    I am trying to get a character in a NSString and i want to put it in a NSMutableString with the command appendString.
    For now it's not working. I try with different approach but i didn't find the right way to do that. It's probably very simple but i just don't see hit.
    I try with characterAtIndex and with getCharater. And now i am thinking to use charcaterRange but i don't know how to articulate an NSRange.
    Maybe somebody could show an example of of what i have to do to do that.
    I put this <<<<<<<<<<<<<<<< to show where in my code it's not working
    Thanks a lot for your help it's very appreciate.
    *The header:*
    #import <Cocoa/Cocoa.h>
    @interface Controleur : NSObject
    NSMutableArray *touche_presser;
    NSMutableArray *typedevariable;
    NSMutableString *formule;
    int calculencours;
    int i;
    int n;
    IBOutlet NSTextField *affichagede_laformule;
    IBOutlet NSTextField *informationdesupport;
    -(void) awakeFromNib;
    -(IBAction)touche_clear:(id)sender;
    -(IBAction)touche_0:(id)sender;
    -(IBAction)touche_1:(id)sender;
    -(IBAction)touche_2:(id)sender;
    -(IBAction)touche_3:(id)sender;
    -(IBAction)touche_4:(id)sender;
    -(IBAction)touche_5:(id)sender;
    -(IBAction)touche_6:(id)sender;
    -(IBAction)touche_7:(id)sender;
    -(IBAction)touche_8:(id)sender;
    -(IBAction)touche_9:(id)sender;
    -(IBAction)touche_plus:(id)sender;
    -(IBAction)touche_moins:(id)sender;
    -(IBAction)touche_multiplier:(id)sender;
    -(IBAction)touche_diviser:(id)sender;
    -(IBAction)touche_egale:(id)sender;
    -(NSString *) constructionde_laformule;
    -(NSNumber *) analysed_unerafale: (NSString *) elementd_uneformule;
    @end
    *The Methode:*
    -(NSNumber *) analysed_unerafale: (NSString *) elementd_uneformule;
    // Ici, j'analyse une partie de la formule et retourne le résultat (nsnumber)
    // dans la variable resultatde_l_analyse_de_larafale
    int ia;
    int nombrede_caractere_dans_element_de_laformule;
    NSNumber *resultat_actuel;
    resultat_actuel = [[NSNumber alloc]initWithInt:0];
    NSNumber *resultat_precedant;
    resultat_precedant = [[NSNumber alloc]initWithInt:0];
    NSNumber *resultatde_l_analyse_de_larafale;
    resultatde_l_analyse_de_larafale = [[NSNumber alloc]init];
    NSMutableString *caractere_x;
    caractere_x = [[NSMutableString alloc]init];
    NSMutableString *operateur;
    operateur = [[NSMutableString alloc]init];
    nombrede_caractere_dans_element_de_laformule = [elementd_uneformule length];
    ia = 0;
    for (n=1; n <= nombrede_caractere_dans_element_de_laformule; n = n+1)
    ia++;
    char y = [elementd_uneformule characterAtIndex:ia]; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< here
    NSString *x = [[NSString alloc] initWithUTF8String: y]; //[NSString stringWithFormat:@"%@", y]; <<<<<<<<<<<<< and here
    [caractere_x setString:@""];
    [caractere_x appendString:x];
    return resultatde_l_analyse_de_larafale;
    @end
    P.S.
    Excuse my bad english i am french speaking

    I also couldn't figure out what your code is doing, but hope this sample code will help:
    NSString *firstString = @"Canada";
    NSMutableString *secondString = [NSMutableString stringWithCapacity:10];
    int index = random() % [firstString length];
    // get a substring of length 1 at the index position of firstString
    NSString *oneCharString = [firstString substringWithRange:NSMakeRange(index, 1)];
    // append the single-character substring to secondString:
    [secondString appendString:oneCharString];
    NSLog(@"firstString=%@ index=%d secondString=%@", firstString, index, secondString);
    I was testing the above when your first reply was posted. It uses the same method Et suggested, but I didn't want to just throw it away.

  • How to get the viewrow value by string

    Using Jdev11.1.1.5.0-adfbc-ireport3.0.0
    here i'll describe: what i did.
    am using jsff(dynamic region) while hitting the af:tree nodes it will opens. ok fine
    i had somevo with manually wroten query. and query is fine no problem with that
    here i give sample not a original query
    select * from sometable where acctid = :pacctidi drag and drop the pacctid from corresponding execute params vo as selectoncechoice
    static vo
    Data value - account payable , advance
    Data Name - ap,ad
    in that jsff
    *page representation*
    account type :   account payable (ap) - select one choice type
                            advance           (ad) - select one choice type
    like this some select once choice and some inputs.
    Run report - command button
    .jsff code
    <af:selectOneChoice value="#{bindings.ACCT_TYPE.inputValue}"
                              label="Account Type"
                              shortDesc="#{bindings.ACCT_TYPE.hints.tooltip}"
                              id="soc3" required="true"
                              autoSubmit="true"
                              binding="#{backingBeanScope.SUP1040V.soc3}"
                              valuePassThru="true"
                              valueChangeListener="#{backingBeanScope.SUP1040V.ValueChangeListener1}">
            <f:selectItems value="#{bindings.ACCT_TYPE.items}" id="si3"/>
          </af:selectOneChoice>
    <af:commandToolbarButton text="Export in pdf" id="ctb2">
              <af:fileDownloadActionListener method="#{backingBeanScope.SUP1040V.Report}"
                                             />
            </af:commandToolbarButton>.java
         //while hitting the button following logs are appeared i show it as commented format.
        public void Report(FacesContext context, OutputStream out) throws IOException,Exception
                FacesContext ctx = FacesContext.getCurrentInstance();
                HttpServletRequest request =
                    (HttpServletRequest)ctx.getExternalContext().getRequest();
                HttpServletResponse response = 
                    (HttpServletResponse)ctx.getExternalContext().getResponse();
                BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                System.out.println("print binding" +bindings1 );
    //while using sop i get this in my log : :  print binding  ReportsPageFragments_SUP1040VPageDef_WEB_INF_TaskFlows_SUP1040_V_TF_xml_SUP1040_V_TF
                JUCtrlListBinding listBinding1 = (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
                System.out.println("print list bindings" +listBinding1 );
    //while using sop i get this in my log : :  print list  bindings0
                Object selectedValue1 = listBinding1.getSelectedValue();
                System.out.println("print selected value" + selectedValue1);
    //while using sop i get this in my log : :  print selected  valueViewRow [oracle.jbo.Key[AP ]]   
    request.setAttribute("ACCT_TYPE", //here i want the value  "AP" in  String  );
    if i use like this means
    request.setAttribute("ACCT_TYPE", soc1.getValue()  );  i get the index value.
    i need the dataname "ap" so i go above method which say wrotes ...
                request.getRequestDispatcher(response.encodeURL("/sup1040servlet")).forward(request,response);
                System.out.println("hihihihih");
                response.flushBuffer();
                ctx.responseComplete();
        public void ValueChangeListener1(ValueChangeEvent valueChangeEvent) {
            // Add event code here...
            String AcctType = valueChangeEvent.getNewValue().toString();
            System.out.println("AcctType" + AcctType);
            FacesContext contxt = FacesContext.getCurrentInstance();
            valueChangeEvent.getComponent().processUpdates(contxt);
           BindingContainer bindings1 =
           BindingContext.getCurrent().getCurrentBindingsEntry();
           // Get the sepecific list binding
           JUCtrlListBinding listBinding1 =
           (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
           // Get the value which is currently selected
           Object selectedValue1 = listBinding1.getSelectedValue();
           System.out.println(selectedValue1);
        }if i get ap means my report runs. or else it will shows empty page.
    how to get the viewrowimpl class value as string.
    Edited by: ADF7 on Mar 24, 2012 7:27 AM

    ADF7,
    I'm not sure I understand what you are up to.
    As far as I understand you want to get the display value instead of the index
    I use this code
        public void StatusChangedListener(ValueChangeEvent valueChangeEvent)
            BindingContext lBindingContext = BindingContext.getCurrent();
            BindingContainer lBindingContainer = lBindingContext.getCurrentBindingsEntry();
            JUCtrlListBinding list = (JUCtrlListBinding) lBindingContainer.get("Status");
            int newindex = (Integer) valueChangeEvent.getNewValue();
            Object row = list.getDisplayData(); // Wichtig um die liste zu laden!!!!
            Row lFromList = (Row) list.getValueFromList(newindex);
            Object lAttribute = lFromList.getAttribute("Value");
            String newVal = (String) lAttribute;
        }to get the value from a selectOneChoice component...
    Timo

  • How to get each frame Info in SWF ?

    Hi,all.
    I met a problem with SWF decomplie.
    If you have edited the fla files, store lots of frames which contains some shape information like pixels color, position and ect
    When you want to get that information in SWF, or rather, each frame information(like colors, pixels position), how to get that by AS3?
    Are there some ideas get frame info by AS3?

    Hi,all.
    I met a problem with SWF decomplie.
    If you have edited the fla files, store lots of frames which contains some shape information like pixels color, position and ect
    When you want to get that information in SWF, or rather, each frame information(like colors, pixels position), how to get that by AS3?
    Are there some ideas get frame info by AS3?

  • How to get the system date format string?

    Hello, everybody!
    I want to create a MaskFormatter with a mask for dates. So, I could suply as the constructor parameter: "##/##/####'. However, what if the year comes first in the current system date format settings, or the month is in the second place or in the first?... So, I can't just suppose that the current locale format for dates is like the one above. So, my question is: is there a way to get the SYSTEM DATE FORMAT STRING in Java? Searching in google I saw that this was already asked in this forum:
    http://forum.java.sun.com/thread.jspa?threadID=301034&messageID=1193794
    but there was no effective answer. Does someone already know how to get this?
    Thank you.
    Marcos

    Hi, not sure, but
    import java.text.*;
    SimpleDateFormat sdf = new SimpleDateFormat();
    System.out.println(sdf.toPattern());
    will output something like dd/MM/yy HH:mm
    hthThank you very much. It worked.

Maybe you are looking for

  • Printer 3510 not working witn windows 8.1 goes to print to file not printing

    IN installed the new driver from the hp website which is supposed to fix the print  problems since  the upgrade to windows 8.1. Now when I  tell the computer to print, it looks like it will print, but it goes to print to file and tries to save the do

  • Does replication group have to be set for session replication

    I have delployed an servlet based application on a 3 node cluster. I have a simple POJO that I use to carry data in the session from a "confirm?" to "confirmed" page. This object implements serializable and only has String and int members. I put it i

  • Emails from hotmail alias still showing as from primary email address - can anyone help?

    Hi, I've added an alias email address using Manage Identities. When I compose an email from that alias address, I can choose my alias email address in the 'From' bar - so that bit seems to be working. But the recipient is still seeing my primary addr

  • Assets = liability + owners equity

    Hello GL gurus, Can you help me to find the following entry's fall into to which category? Dr. Receivable (Is it asset or liability or owners equity?) Cr. Unearned (Is it asset or liability or owners equity?) Cr. Revenue (Is it asset or liability or

  • Change the security question?

    I been trying the last two days to change my question and there is not a spot for changing the questions. I am really getting upset because I have money on my iTunes to buy stuff and I can't.  If I knew if this was going to be this hard I wouldn't bu