Removing non-alpha-numeric characters from a string

How can I remove all non-alpha-numeric characters from a string? (i.e. only alpha-numerics should remain in the string).

Or even without a loop ?
Extract from the help for the Search and Replace String function :
Right-click the Search and Replace String function and select Regular Expression from the shortcut menu to configure the function for advanced regular expression searches and partial match substitution in the replacement string.
Extract from the for the advanced search options :
[a-zA-Z0-9] matches any lowercase or uppercase letter or any digit. You also can use a character class to match any character not in a given set by adding a caret (^) to the beginning of the class. For example [^a-zA-Z0-9] matches any character that is not a lowercase or uppercase letter and also not a digit.
Message Edité par JB le 05-06-2008 01:49 PM
Attachments:
Example_VI_BD4.png ‏2 KB

Similar Messages

  • How can I remove all non alpha/space characters from a string

    Subject changed by moderator.  Please use a meaningful subject in future.
    Hi all,
    Can anyone tell me.
    how to get only alphabets & spaces from the string..
    suppose..
    raj*&{]afhajk ajkf_+#fkh jah jka7767jk hhha
    I need only
    rajafhajk ajkf fkh jah jkajk hhha
    thanks..
    Rajeev
    Edited by: Matt on Feb 17, 2009 3:36 PM

    This will work.
    CONSTANTS:
      sm2big(52) VALUE
        'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'.
    DATA:
      str_out(60),
      str_in(60) VALUE
      'raj*&{]afhajk ajkf_+^#^fkh jah jka7767jk hhha',
      my_len          TYPE i,
      pos1            TYPE i,
      pos2            TYPE i.
    START-OF-SELECTION.
      COMPUTE my_len = strlen( str_in ).
      CLEAR pos1.
      CLEAR pos2.
      WHILE pos1 LT my_len.
        IF str_in+pos1(1) co sm2big
        OR str_in+pos1(1) EQ ' '.
          str_out+pos2(1) = str_in+pos1(1).
          pos2 = pos2 + 1.
        ENDIF.
        pos1 = pos1 + 1.
      ENDWHILE.
      WRITE:/ 'String In', str_in.
      WRITE:/ 'String Out', str_out.
    and the output
    String In      raj*&{]afhajk ajkf_+^#^fkh jah jka7767jk hhha
    String Out   rajafhajk ajkffkh jah jkajk hhha            

  • Gists Created with non alpha numeric characters

    Hi,
    I am using Gists in my APEX application. When I upload a word document that contains tables and charts, I get a really long unmeaningful gist for that document.
    For example, I get this gist (5x longer):
    PROJECT MINT ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— PROJECT MINT ———————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— PROJECT MINT ——————————————————————————————————————————————————————————————————————————————————————————————————————
    How can I only return or create gists that are alpha numeric?
    Thanks,
    jnguyen

    There might be another option that I'm not aware of, but this might just do the trick for you (I don't have a live Oracle connection available to me at this moment so I couldn't test it, you might need to debug it):
    select * from tablename where 0 <> length(replace(translate(lower(columnname),'abcdefghijklmnopqrstuvwxyz1234567890',' '),' ',''));
    What it does is it takes the string from the column, converts all letters and digits into spaces, removes the spaces and compares the length with 0. If the string contains 'strange' characters, they will not get removed and thus turnup a length greater than 0. Pittfalls:
    1) Make sure the number of spaces in the second argument of the translate is equal to the number of characters in the first argument.
    2) This doesn't make use of indexes...
    HTH,
    Lennert

  • Non alpha-numeric characters

    Folks, is there a way of finding records in a varchar2 field which has funny characters. In this case users have entered funny characters (^ and others which I cannot produce) in the field and oracle has saved them successfully. When we send the file to other system they reject it.
    Is there a way in Oracle where we can look for characters which are neither alpha or numeric?

    There might be another option that I'm not aware of, but this might just do the trick for you (I don't have a live Oracle connection available to me at this moment so I couldn't test it, you might need to debug it):
    select * from tablename where 0 <> length(replace(translate(lower(columnname),'abcdefghijklmnopqrstuvwxyz1234567890',' '),' ',''));
    What it does is it takes the string from the column, converts all letters and digits into spaces, removes the spaces and compares the length with 0. If the string contains 'strange' characters, they will not get removed and thus turnup a length greater than 0. Pittfalls:
    1) Make sure the number of spaces in the second argument of the translate is equal to the number of characters in the first argument.
    2) This doesn't make use of indexes...
    HTH,
    Lennert

  • RegEx Query - non alpha numeric characters

    Hi,
    On our Oracle EBS system users can paste data into the system and "strange" characters are not trapped, therefore they can paste into forms from e.g. word and include non standard characters. Sorry if that sounds vague.
    I need to be able to find the non alphanumeric chars in a table which are "breaking" an interfaced system which takes data from Oracle and puts some of it into an XML file. Other valid characters we don't have a problem with are e.g.
    !"£$%^&*()_+-=[{]};:'@,<.>/?\|
    For example, I know one character that causes a problem is the character MS Word uses to replace a dash.
    e.g. if I type:
    *this - that*
    Word changes it to:
    *This – that*
    That's a character I can't type on my keyboard, and an example of a character I'd like to be able to find using SQL.
    There are probably others, but all I would like to do is to find "non standard" characters.
    I have one sample transaction ID I know contains the funny MS dash, so this SQL returns it:
    SELECT pec.expenditure_comment
      FROM pa.pa_expenditure_comments pec
    WHERE REGEXP_LIKE (pec.expenditure_comment
                      , '(^ )|[^[:alnum:] &!"£$%^()_+=-{};:@#~,<.>/?\|]')
       AND pec.expenditure_item_id = 6445260However, it also returns other records which don't contain funny characters, so I don't think it is working correctly.
    Hence me asking for advice here. Any assistance would be much appreciated.
    Thanks

    966480 wrote:
    Hi,
    On our Oracle EBS system users can paste data into the system and "strange" characters are not trapped, therefore they can paste into forms from e.g. word and include non standard characters. Sorry if that sounds vague.
    I need to be able to find the non alphanumeric chars in a table which are "breaking" an interfaced system which takes data from Oracle and puts some of it into an XML file. Other valid characters we don't have a problem with are e.g.
    !"£$%^&*()_+-=[{]};:'@,<.>/?\|Are the square bracket characters, '[' and ']' acceptable? The code you posted below doesn't allow them.
    For example, I know one character that causes a problem is the character MS Word uses to replace a dash.
    e.g. if I type:
    *this - that*
    Word changes it to:
    *This – that*
    That's a character I can't type on my keyboard, and an example of a character I'd like to be able to find using SQL.
    There are probably others, but all I would like to do is to find "non standard" characters.Thee are some built-in character classes, such as [:print:] and [:graph:], that might make this job a little simpler for you.
    I have one sample transaction ID I know contains the funny MS dash, so this SQL returns it:
    SELECT pec.expenditure_comment
    FROM pa.pa_expenditure_comments pec
    WHERE REGEXP_LIKE (pec.expenditure_comment
    , '(^ )|[^[:alnum:] &!"£$%^()_+=-{};:@#~,<.>/?\|]')
    AND pec.expenditure_item_id = 6445260
    The hyphen character ( '-' ) has a special meaning inside square brackets. If you want to include a literal hyphen in the set, then put it at the very beginning (right after the '[') or the very end (right before the ']'); for example:
      WHERE REGEXP_LIKE (pec.expenditure_comment
                       , '(^ )|[^[:alnum:] &!"£$%^()_+={};:@#~,<.>/?\|-]')
    {code}
    The right square bracket, ']', also has a special meaning: it ends the set.  If you want to include a literal right ']' in the set, it must be the very first character.  The following code does not find the square brackets funny:
    {code}
      WHERE REGEXP_LIKE (pec.expenditure_comment
                       , '(^ )|[][^[:alnum:] &!"£$%^()_+={};:@#~,<.>/?\|-]')
    However, it also returns other records which don't contain funny characters, so I don't think it is working correctly.The query you posted, and both of my suggestions, will pick strings that start with a space, whether or not any funny characters come later. If you want to accept strings whether or not they start with spaces (just so long as they do not contain any funny characters) then lose the '(^ )|'; for example:
      WHERE REGEXP_LIKE (pec.expenditure_comment
                       , '[][^[:alnum:] &!"£$%^()_+={};:@#~,<.>/?\|-]')
    {code}
    >
    Hence me asking for advice here. Any assistance would be much appreciated.I hope that answers your question.
    If not, post some sample data (CREATE TABLE and INSERT statements) so people can re-create the problem and test their ideas.  Also post the correct results you want from the given sample data.
    Edited by: Frank Kulash on May 31, 2013 10:11 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Outlook password non alpha-numeric characters

    i just updated my password, including an @ symbol. The password works with AppleID and outlook via MSN, but when I try to update or reset the password on iPhone and iPad (both iOS8), they can't recognize the password. Anyone with workaround or similar issue?

    There might be another option that I'm not aware of, but this might just do the trick for you (I don't have a live Oracle connection available to me at this moment so I couldn't test it, you might need to debug it):
    select * from tablename where 0 <> length(replace(translate(lower(columnname),'abcdefghijklmnopqrstuvwxyz1234567890',' '),' ',''));
    What it does is it takes the string from the column, converts all letters and digits into spaces, removes the spaces and compares the length with 0. If the string contains 'strange' characters, they will not get removed and thus turnup a length greater than 0. Pittfalls:
    1) Make sure the number of spaces in the second argument of the translate is equal to the number of characters in the first argument.
    2) This doesn't make use of indexes...
    HTH,
    Lennert

  • IDOMServices Parse giving error for non-alpha numeric characters in content

    Hi All,
    Using Adobe InDesign CS4 SDK 557, I want to create IIDXMLDOMDocument * from a xml stored in a PMString variable.
    I used the following code to parse the xml:-
    InterfacePtr<IK2ServiceRegistry> servReg(GetExecutionContextSession(), UseDefaultIID());
    InterfacePtr<IK2ServiceProvider> provider(servReg->QueryServiceProviderByClassID (kDOMParserService, kDOMParserServiceBoss )); 
    InterfacePtr<IDOMServices> domService( provider, UseDefaultIID() ); 
    if(!domService)
        break;
    std::string stdString = myXMLString.GetPlatformString();
    const char * buff = stdString.c_str();
    InterfacePtr<IPMStream> pmStream(StreamUtil:: CreatePointerStreamRead( (char *)buff, stdString.size()));
    IIDXMLDOMDocument * parsedDom = domService->Parse( pmStream );
    -  Now the problem is when myXMLString have some special character like “0x27” , “0x14” etc. then IDOMServices::Parse fails.
    -  I tried replacing these characters with “&#x27;”, “&#x14;” but still IDOMServices::Parse fails.
    I also tried to used ISAXServices::ParseStream, but it also gives error for the same character.
    Also tried setting ISAXParserOptions::SetAbortAfterWarning(kFalse), but not changed in result.
    Please let me know if I am missing something.
    Thanks,
    Jitendra Kumar Singh

    Hi Nitika Saini,
    Please let me know what's your patch level of BI 7 system.
    I am also facing problem with transformations, I didn't see any transper routines in my system for 0IC_C03 - 2LIS_03_BX, LIS_03_BF, 2LIS_03_UM.
    Here, my BI 7 patch level BI content 8 and BW pathc 16.
    Thanks,
    Chandra

  • Removing non-numeric characters from string

    Hi there,
    I need to have the ability to remove non-numeric characters from a string and I do not know how to do this.
    Does any one know a way?
    Example:
    Present String: (02)-2345-4607
    Required String: 0223454607
    Thanks in advance

    Dear NickM
    Try this this will work...........
    create or replace function char2num(mstring in varchar2) return integer
    is
    -- Function to remove Special characters and alphebets from phone no. string field
    -- Author - Valid Bharde.(India-Mumbai)
    -- Date :- 20 Sept 2006.
    -- This Function will return numeric representation.
    -- The Folowing program is gifted to NickM with respect to his post on oracle site regarding Removing non-numeric characters from string on the said date
    mstatus number :=0;
    mnum number:=0;
    mrefstring varchar2(50);
    begin
    mnum := length(mstring);
    for x in 1..mnum loop
    if (ASCII(substr(upper(mstring),x,1)) >= 48 and ASCII(substr(upper(mstring),x,1)) <= 57) then
    mrefstring := mrefstring || substr(mstring,x,1);
    end if;
    end loop;
    return mrefstring;
    end;
    copy the above program and use it at function for example
    SQL> select char2num('(022)-453452781') from dual;
    CHAR2NUM('(022)-453452781')
    22453452781
    Chao!!!

  • Removing non english characters from my string input source

    Guys,
    I have problem where I need to remove all non english (Latin) characters from a string, what should be the right API to do this?
    One I'm using right now is:
    s.replaceAll("[^\\x00-\\x7F]", "");//s is a string having chinese characters.
    I'm looking for a standard Solution for such problems, where we deal with multiple lingual characters.
    TIA
    Nitin

    Nitin_tiwari wrote:
    I have a string which has Chinese as well as Japanese characters, and I only want to remove only Chinese characters.
    What's the best way to go about it?Oh, I see!
    Well, the problem here is that Strings don't have any information on the language. What you can get out of a String (provided you have the necessary data from the Unicode standard) is the script that is used.
    A script can be used for multiple languages (for example English and German use mostly the same script, even if there are a few characters that are only used in German).
    A language can use multiple scripts (for example Japanese uses Kanji, Hiragana and Katakana).
    And if I remember correctly, then Japanese and Chinese texts share some characters on the Unicode plane (I might be wrong, 'though, since I speak/write neither of those languages).
    These two facts make these kinds of detections hard to do. In some cases they are easy (separating latin-script texts from anything else) in others it may be much tougher or even impossible (Chinese/Japanese).

  • Removing alpha numeric characters

    Hi,
    Can anybody please tell me how can I remove the alpha numeric characters, inluding spaces from a column value.
    Thanks in advance

    Thanks for the help. But this extracts the alpha
    numeric characters and and print those. What I need
    is i want all those column values without these alpha
    numeric characters.You said...
    Can anybody please tell me
    how can I remove the alpha numeric characters, inluding spaces from a column value.So I showed you to to remove alpha numeric characters and spaces from a column value.
    So I think you need to be clear in your requirements.
    Do you want all rows where there are values that only have alpha numerics in them i.e. don't show the rows that have non-alpha numeric or spaces in a particular value?
    or
    Do you want all rows, but you want to strip out non alpha-numerics and spaces from particular values?
    Perhaps if you give an example of your data and what you expect the result to be that may give us a better idea, because what I gave you as a solution was correct for the requirement you specified.

  • Removing Non-numeric characters from Alpha-numeric string

    Hi,
    I have one column in which i have Alpha-numeric data like
    COLUMN X
    +91 (876) 098 6789
    1-567-987-7655
    so on.
    I want to remove Non-numeric characters from above (space,'(',')',+,........)
    i want to write something generic (suppose some function to which i pass the column)
    thanks in advance,
    Mandip

    This variation uses the like operators pattern recognition to remove non alphanumeric characters. It also
    keeps decimals.
    Code Snippet
    CREATE FUNCTION dbo.RemoveChars(@Str varchar(1000))
    RETURNS VARCHAR(1000)
    BEGIN
    declare @NewStr varchar(1000),
    @i int
    set @i = 1
    set @NewStr = ''
    while @i <= len(@str)
    begin
    --grab digits or (| in regex) decimal
    if substring(@str,@i,1) like '%[0-9|.]%'
    begin
    set @NewStr = @NewStr + substring(@str,@i,1)
    end
    else
    begin
    set @NewStr = @NewStr
    end
    set @i = @i + 1
    end
    RETURN Rtrim(Ltrim(@NewStr))
    END
    GO
    Code to validate:
    Code Snippet
    declare @t table(
    TestStr varchar(100)
    insert into @t values ('+91 (8.76) \098 6789');
    insert into @t values ('1-567-987-7655');
    select dbo.RemoveChars(TestStr)
    from @t

  • TS3276 I need feedback for the following issue. When I send email from this 27 inch iMac, the computer adds a string of characters in vertical column that represents the QWERTY key board, all alpha numeric characters are included. Yahoo mail, issue only o

    Restating my issue / question...
    When I send email from this iMac, there is a string of characters assigned. The characters are all the "alpha numeric" characters on the QWERTY key board. This only occurs when email is sent from this iMac. The issue does not manifest when using any other lap top or computer.
    Hence, I have ruled out the issue is a yahoo mail matter.
    Again, I can access the Yahoo mail account form multiple devices and send email without unintended assignment of character strings, but when I send wmail using this iMac, the issue happens everytime.
    Characters are stacked verticaly in a column. It looks as if all characters (except function keys) are included in the string.
    Any ideas?
    GMc

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit 
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; } | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}' | open -f -a TextEdit 
    Step 4
    ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null | open -f -a TextEdit  
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit 
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • Removing characters from a String (concats, substrings, etc)

    This has got me pretty stumped.
    I'm creating a class which takes in a string and then returns the string without vowels and without even numbers. Vowels and even characters are considered "invalid." As an example:
    Input: "hello 123"
    Output: "hll 13"
    The output is the "valid" form of the string.
    Within my class, I have various methods set up, one of which determines if a particular character is "valid" or not, and it is working fine. My problem is that I can't figure out how to essentially "erase" the invalid characters from the string. I have been trying to work with substrings and the concat method, but I can't seem to get it to do what I want. I either get an OutOfBoundsException throw, or I get a cut-up string that just isn't quite right. One time I got the method to work with "hello" (it returned "hll") but when I modified the string the method stopped working again.
    Here's what I have at the moment. It doesn't work properly for all strings, but it should give you an idea of where i'm going with it.
    public String getValidString(){
              String valid = str;
              int start = 0;
              for(int i=0; i<=valid.length()-1; i++){
                   if(isValid(valid.charAt(i))==false){
                             String sub1 = valid.substring(start, i);
                             while(isValid(valid.charAt(i))==false)
                                  i++;
                             start=i;
                             String sub2 = valid.substring(i, valid.length()-1);
                             valid = sub1.concat(sub2);
              return valid;
         }So does anybody have any advice for me or know how I can get this to work?
    Thanks a lot.

    Thansk for the suggestions so far, but i'm not sure how to implement some of them into my program. I probably wasn't specific enough about what all I have.
    I have two classes. One is NoVowelNoEven which contains the code for handling the string. The other is simply a test class, which has my main() method, used for running the program.
    Here's my class and what's involved:
    public class NoVowelNoEven {
    //data fields
         private String str;
    //constructors
         NoVowelNoEven(){
              str="hello";
         NoVowelNoEven(String string){
              str=string;
    //methods
         public String getOriginal(){
              return str;
         public String getValidString(){
              String valid = str;
              int start = 0;
              for(int i=0; i<=valid.length()-1; i++){
                   if(isValid(valid.charAt(i))==false){
                             String sub1 = valid.substring(start, i);
                             while(isValid(valid.charAt(i))==false)
                                  i++;
                             start=i;
                             String sub2 = valid.substring(i, valid.length()-1);
                             valid = sub1.concat(sub2);
              return valid;
         public static int countValidChar(String string){
              int valid=string.length();
              for(int i=0; i<=string.length()-1; i++){
                   if(isNumber(string.charAt(i))==false){
                        if((upperVowel(string.charAt(i))==true)||lowerVowel(string.charAt(i))){
                             valid--;}
                   else if(even(string.charAt(i))==true)
                        valid--;
              return valid;
         private static boolean even(char num){
              boolean even=false;
              int test=(int)num-48;
              if(test%2==0)
                   even=true;
              return even;
         private static boolean isNumber(char chara){
              boolean number=false;
              for(int i=0; i<=9; i++){
                   if((int)chara-48==i){
                        number=true;
              return number;
         private static boolean isValid(char chara){
              boolean valid=true;
              if(isNumber(chara)==true){
                   if(even(chara)==true)
                        valid=false;
              if((upperVowel(chara)==true)||(lowerVowel(chara)==true))
                   valid=false;
              return valid;
    }So in my test class i'd have something like this:
    public class test {
    public static void main(String[] args){
         NoVowelNoEven test1 = new NoVowelNoEven();
         NoVowelNoEven test2 = new NoVowelNoEven("hello 123");
         System.out.println(test1.getOriginal());
         //This prints hello   (default constructor string is "hello")
         System.out.println(test1.countValidChar(test1.getOriginal()));
         //This prints 3
         System.out.println(test1.getValidString());
         //This SHOULD print hll
    }

  • Sorting of alpha numeric characters in a column`

    Hi All,
    I have a column which has alpha numeric characters like 1A, 12B, 14D, 12CC ...etc.
    I need to sort this column in ascending as well as descending. The normal "sort by" does not work and the ASCII function return on the ascii value of the 1st character in the cell.
    Can you please help me out?

    Needed more sample data..
    For provided data, ie if Number comes only at the beginning, you can ..
    SQL> select c1
      2  from t
      3  order by to_number(translate(c1,translate(c1,'a0123456789','a'),' ')),c1;
    C1
    1A
    12B
    12CC
    14D                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Removing leading and trailing delimiters from a String

    I need to remove leading and trailing delimiters from a String like if my string is 111,112, then it should get changed to 111,112.Any idea how to do this??

    for my suggestion:String s = "111,112,";
    int begin = 0;
    while (!Character.isLetterOrDigit(s.charAt(begin)))
         begin++;
    int end = s.length() - 1;
    while (!Character.isLetterOrDigit(s.charAt(end)))
         end--;
    String news = s.substring(begin, end + 1);Of course, you'll have to clean it up a bit.

Maybe you are looking for

  • Exception in assigning XML elements value in Workshop

    Hi , I tried creating a variable of type XML object(OrderREsponse). I have one MB Publisher control which sends in a variable of type OrderResponse. Before sending it , I try setting the individual XML elements value in it. So, for all the individual

  • MB51 - Add a field in output list

    We changed the layout of MB51 to add, in the output screen (ALV list), the fields: MSEG-ANLN1 (main asset number), MSEG-ANLN2 (asset subnumber). The customer also wants to have the field ANLA-MCOA1 (asset description). How do we add? Maybe there are

  • Unable to execute Linux command from Java

    Hi, I am currently working on a code wherein i need to execute Linux command from Java. Below are some of the query i have. 1) Is there any efficient method of running OS commands from Java, rather than using Runtime and Process method. 2) Below is d

  • Custom chained authentication

    Hi I need to setup a way for all users logging into a webgate to be presented with an acceptable use agreement before they are allowed access to the application. This only needs to happen on the first login. This is not possible out of the box, has a

  • Set up iCloud keychain - country isn't in list

    I'm trying to set up iCloud Keychain. Problem is, when I get to the part that says "Enter your phone number where SMS can be sent", my country isn't in the dropdown list. I live in Papua New Guinea (+675).