Delete char/s from whole string

aceXaceX Member Posts: 166
edited 2014-09-12 in NAV Three Tier
Hi there guys, I like to ask, does have some function in C/AL to cut char from string, for example

string NumToWord
NumToWord getting value one thousand and fifty two hundred and dollars

so, here I want to inspect, does before dollars I have 'and', if there is 'and' to be deleted from the string. The problem here is when I use DELCHR function, all and are getting deleted.

Thanks to all
Best regards

Comments

  • jglathejglathe Member Posts: 639
    Delstr?
  • aceXaceX Member Posts: 166
    With DELSTR I can remove 'and' everywhere in the string, but I want to remove 'and' only at the end. My first example was bad, sorry, I like to do this
    one thousand and fifty two hundred and dollars
    
    to convert in
    one thousand and fifty two hundred dollars
    

    :-k
  • aceXaceX Member Posts: 166
    At the end I get it that I've asked stupid question. I doubt there is function like this in C/AL but I've done this with STRLEN and DELSTR
    Counter := STRLEN(NumToWord);
    ClearedNumToWord := DELSTR(NumToWord, Counter - 11, 3);
    

    :lol:
  • jglathejglathe Member Posts: 639
    Hi,

    the calling syntax is:

    NewString := DELSTR(String, Position[, Length])

    That's "cut <length> chars from <position> on aut of <string>". So, the way to go would be to identify the position and length of the substring you want to cut.

    with best regards

    Jens
Sign In or Register to comment.