Trim Space from a string

Hello All,
I need to trim space from beginning and end of a string.
For example -
astring = ' hello123 '.
I need to get astring as 'hello123'.
Thanks in advance.
Viren

Hi Viren,
You can code like this
WRITE ASTRING TO ASTRING NO-GAP.
Hope this will help.
Regards,
Ferry Lianto

Similar Messages

  • How to trim spaces from string in BMM layer?

    Hi friends,
    I need to trim spaces from the string. can you please give me syntax with example.
    Thanks

    Hi
    I have tried the below option , but it did not work . PS_D_PERSON
    PERSON_ID is char type in the data base oracle , and it is defined as varchar on the physical layer .
    So the table is loaded with space , i am not able to remove the space using trim both
    Thanks
    Sridhar.N

  • Stripping extra white space from a string

    I am trying to strip extra spaces from a string, so it there are 2 or more spaces between a word I want to remove all but one. I am trying the following code
    getStringTwo().replaceAll("/\s+/is","");
    but all I get is an error saying Invalid escape sequence
    Thanks
    G

    >
    This strips out all the whitespace. I ended up
    getting round it by walking through the string and
    checking the values of each char and comparing that
    to the next value. What a wast of effortt A small modification of my earlier post gives -
    public class Test040320a
        public static void main(String[] args)
            String str = "this    is       a \t test";
            str = str.replaceAll("\\s+"," ");
            System.out.println(str);
    }

  • Getting rid of trailing space from a string variable

    I need to delete trailing blank spaces in a string variable. Is there a method that can do the job?
    Thanks

    String.trim(). Example: " booh! ".trim() returns "booh!".

  • Flash Builder 4 List controls trimming spaces from XML node values

    I'm trying to migrate my Flex 3 application to Flash builder 4.  One issue that I have is that one of my datasources returns a list of cities and regions.  To get the regions to display in the correct order in Flex 3, a space was added to to their name in the database (ie. "West", "Northwest" are stored in the database as " West" and " Northwest" so that when sorted by the sql query they would appear at the top and gets translated to XML to fill in a list box or combo box in my Flex 3 application.  I have functions that take that selected city or region value from the combo box and queries the database for various performance metrics.  In migrating to Flash Builder 4, I noticed that the spaces in the region names no longer appear in the combo boxes.  When I show the data in a datagrid, the spaces are still there but when populating a combo box or list box, the leading space gets trimmed.  This is an issue since if a user selects the value "West", it doesn't find it in the database since it is listed as " West".  This wasn't an issue in Flex Buider 3.  Is there a work around or parameter that I can set to force the combo box or list box to show the data as-is versus having it trim off the leading spaces for my regions?
    Also, a stupid question, in Flex 3, you were able to find the select value of a combo box by using comboBox.text.  What is the equivalent in Flash Builder 4?  Do I need to do comboBox.selectedItem.Region.toString() now or is there a shortcut to pull the text from the combo box?

    I think you want this:
    private function onLoadPortfolioData(event:ResultEvent):void
        var obj:XMLList = event.result.img as XMLList;
        if (obj.length > 0)
            _imgCollection = new XMLListCollection(obj);
            pictureList.dataProvider = _imgCollection;
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.stardustsystems.com
    Adobe Flex Development and Support Services

  • Take out spaces from a string

    I got a StringTokenizer:
    while ((fullText = in.readLine()) != null) {
        ++line;
        StringTokenizer tokenizer = new StringTokenizer(fullText, "=");
    }It take my fullText string "key = value" into "key " and " value", I want to take out those white space, someone?

    If you do:while ((fullText = in.readLine()) != null) {
        ++line;
        StringTokenizer tokenizer = new StringTokenizer(fullText, "=");
        String key = tokenizer.nextToken().trim();
        String value = tokenizer.nextToken().trim();
    }Only the leading and trailing whitespaces of key and value will be discarded.
    Regards

  • Need to trim space from time field

    I've got a text box in my report where I am dropping in two times: start time and end time.
    {EarlyShiftStart}-{LateShiftEnd}
    My problem is if the late shift end is a time less than 10, it adds an extra space between the "-" and the start time.
    So instead of:
    8:00 AM-3:00PM
    it is 8:00 AM- 3:00 PM.
    Is there a way to have this extra or padded space removed?
    Thanks,

    Hi,
    What is the data type of your database fields for times?
    If those are of type datetime, then you can use cStr(<your database field>, "hh:mm tt"), which will give you the time part as required by you and can try something like this:
    cStr(<your database field for early shift time>, "hh:mm tt") & '-' & cStr(<your database field late shift time>, "hh:mm tt")
    Thanks,
    Raghavendra

  • 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            

  • How to get First Occurnece of SubString from any string using SharePoint Designer Workflow in SharePoint Online 2013(Office 365)

    Hello All,
    I am facing Problem in SharePoint Designer Workflow. The Problem is that while replacing some subtstring with Space from a string which contains item like {Test, Test, Test, Test}, It replaces all items.
    Below two line we are using in Workflow.
    Can any body suggest some soultion for Finding first ouucrence of ", " so that we can replace only first value from string not all. When String values are different then getting proper values but if String values are same with comma
    seperated then it replace all values.
    Please some body help and your help will be heighly appriciable.
    Thanks in Advance.
    Thanks,
    Vivek Kumar Pandey   

    Have you tried to use Regular Expressions instead of Replace?
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Is trim(both from string) is the same as trim(string)...

    trim(both from string) is the same as trim(string)...
    like in
    SELECT trim(both from STRING_COLUMN) "A" , trim(STRING_COLUMN) "B" from TEXT_TABLE
    will "A" and "B" will be same
    I know this was asked in previous threads , but wanted clarify ..Thanks in advance

    Yes, they are the same
    (See the syntax diagram here http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions153a.htm#SQLRF06149)

  • Remote white space from string

    Hi I need a method which will remove the spaces in a string eg "Hello World" -> "HelloWorld"
    I have the code below but it dosnt work for the obvious reason charAt() returns a char and im comparing to a string.
    Can anyone offer any help? Thanks
              public void removeSpace(String s)
              {     int rs = s.length();
                   String cat;
                   for (int i=0;i<rs;i++) {
                        cat = s.charAt(i).toString();
                        if (cat==" ") {
                             s.replace(""," ");
              }

    Hi I need a method which will remove the spaces in a
    string eg "Hello World" -> "HelloWorld"
    I have the code below but it dosnt work for the
    obvious reason charAt() returns a char and im
    comparing to a string.
    Can anyone offer any help? Thanks
              public void removeSpace(String s)
              {     int rs = s.length();
                   String cat;
                   for (int i=0;i<rs;i++) {
                        cat = s.charAt(i).toString();
                        if (cat==" ") {
                             s.replace(""," ");
    Hi,
    You can't modify the contents of a String, you must create a new String, and use that one. Your code should be:
    public String removeSpace(String s) {
        return s.replaceAll(" ", "");
    }The returned string is the string without spaces.
    /Kaj

  • Error While creating a rule for trimming spaces

    Hi All,
    Please can you tell me the correct syntax for trimming the Spaces from the beginning of the word.
    I tried like this but it is giving error as below:
    BEGIN RETURN
    ltrim($SPACES_TRIM, '');
    END
    ERROR:  The return statement is expected to return a conditional value: found type<VARCHAR>. (COR-10622)
    Please do help me its urgent.
    Thanks & Regards,
    DJ

    Hi Deepak,
    when you create validation rules they always have to return TRUE or FALSE conditions. (A record can pass or fail your expression.
    So your expression above returns a VARCHAR string, as you can read in the User guide, you are replacing leading nothing '' at the beginning of your string $SPACES_TRIM.
    You need to understand basic concept for validation rule expressions and use of functions.
    There are lots of great product tutorials here on the SCN, that describe scope, features and functionalities of Information Steward, so you got a understanding of what you can do with IS.
    NIels

  • DB adapter - Trim spaces in column

    Hi,
    We are facing an issue while using DB adapter when retrieving data from a column (VARCHAR2).
    Our column contains data like 'XXXX<spaces>XXX<spaces>'. Whenever we retrieve this column using Db adapter (both custom sql and Select option) and we are getting data with spaces trimmed.
    For eg- Data is "1234 34456 3444". Db adapter retrieves this as 1234344563444.
    We need the data to be retrieved as existing in the column.
    Please let us know if anyone has seen this before, any inputs will be appreciated.
    Regards,
    ARPL

    Hi,
    I think it's very unlikely DbAdapter would remove spaces from the middle in a string... There's probably another problem associated...
    If confirmed open a SR with Oracle Support.
    Cheers,
    Vlad

  • What does the trim() method of the String class do in special cases?

    Looking here ( String (Java Platform SE 7 ) ), I understand that the trim() method of the String class "returns a copy of the string, with leading and trailing whitespace omitted", but I don't understand what the last special case involving Unicode characters is exactly.
    Looking here ( List of Unicode characters - Wikipedia, the free encyclopedia ), I see that U+0020 is a space character, and I also see the characters that follow the space character (such as the exclamation mark character).
    So, I decided to write a small code sample to try and replicate the behaviour that I quoted (from the API documentation of the trim method) in the multi-line comment of this same code sample. Here is the code sample.:
    public class TrimTester {
        public static void main(String[] args) {
             * "Otherwise, let k be the index of the first character in the string whose code
             * is greater than '\u0020', and let m be the index of the last character in the
             * string whose code is greater than '\u0020'. A new String object is created,
             * representing the substring of this string that begins with the character at
             * index k and ends with the character at index m-that is, the result of
             * this.substring(k, m+1)."
            String str = "aa!Hello$bb";
            System.out.println(str.trim());
    However, what is printed is "aa!Hello$bb" (without the quotes) instead of "!Hello$" (without the quotes).
    Any input to help me better understand what is going on would be greatly appreciated!

    That's not what I was thinking; I was thinking about the special case where the are characters in the String whose Unicode codes are greater than \u0020.
    In other words, I was trying to trigger what the following quote talks about.:
    Otherwise, let k be the index of the first character in the string whose code is greater than '\u0020', and let m be the index of the last character in the string whose code is greater than '\u0020'. A new String object is created, representing the substring of this string that begins with the character at index k and ends with the character at index m-that is, the result of this.substring(k, m+1).
    Basically, shouldn't the String returned be the String that is returned by the String class' substring(3,9+1) method (because the '!' and '$' characters have a Unicode code greater than \u0020)?
    It seems to not be the case, but why?

  • Stripping HTML Tags from a String

    What's the best way to remove html tags from a string (i.e. user input)?

    Can you give an example? You can do substring, if your passing spaces between pages you can do a trim to the variable. Also look at the indexOf(). Look at methods relating to java.lang.String.

Maybe you are looking for

  • How to Register as a Developer on SAP NetWeaver ABAP 7.02 Trial Version

    Hi Everyone, I was following a tutorial on ABAP and this centred on "Hello World" application. I got a message that I haven't been registered as a Developer on the system and that I need some code from OSS. I have tried checking here for any clues bu

  • Crystal Reports 8.5 and Barcode field on Postscript printer

    Hi, I have a Crystal 8.5 document with a barcode Code128 inside (Azale font). If I print the document on a PLC printer using Azalea Truetype font the Barcode are printed. If I print the document on a PostScript printer the barcode are not printed. If

  • Stock from block to quality after UD

    Dear Team We want to bring back stock from block to quality and UD is done and we can not do it through mb1b and movement type 349 because QM is activated in material, please help? Regards Ramesh kumar

  • HTML dynamic content email bursting (no attachment)

    Hello, Could you please advise if the below scenario is feasible using BI Publisher: An email need to be bursted. This email should have an html template in it (with some dynamic values, like name, etc. - "Dear X,"). This html template should include

  • Vector and my object??

    hi all, I am reading a binary file, then creating the object and adding that object in my vector. How can i get it back according to its id? let is say i added all the customers read from file and now i want to get customer 3? int thisId=dis.readInt(