LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Removing specific characters in a string

    Employee
    Posted 09-02-2016 06:51

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: arunchandra

    Hi All,

    I have my string list as the following

    A.K.A Abraham Moh
    N.D.
    Yoalnda
    V.
    C.Edreira

    I need to get rid of all the "." in the middle as well as at the end. Can you please let me know how to achieve this. I tried split..but it wont let me seperate other than the first "."...


  • 2.  RE: Removing specific characters in a string

    Employee
    Posted 09-02-2016 07:15

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    You can simply do this:

    override emit myField = myField.replace("."," ").trim()


  • 3.  RE: Removing specific characters in a string

    Employee
    Posted 09-02-2016 07:19

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ltolleson

    You can use a filter node with the following scripting code.

    textString = "Some.sting.of.characters"
    newString = textString.replace(".", " ")
    
    emit textString, newString
    In the example above I replaced the "." with a space " ". You can replace any string of characters with another string of characters using the replace function.
    Of course this is just using a hard coded literal string value. You can also use an input string field as well. It would look like this.

    textString = 'someFieldName'
    newString = textString.replace(".", " ")
    
    emit textString, newString
    You can also use the regular expression functions if you need more complex string manipulation. They all start with "regex".