looking for special signs

i need to exctract a substring from a string. The seperator is either the tabulator (sign number 9) or the linefeed (sign number 10). Hence i’ve created a function which reads out the string until it finds a seperator: W := 0; WHILE (Zeile[ab + W] <> 9) AND (Zeile[ab + W] <> 10) DO W += 1; X := COPYSTR(Zeile, ab, W - 1); (“Zeile” is the string, “X” contains the substring and “ab” is the place where the search begins within the string). Unfortunately there is found no seperator, although the string has 5 of them. Where’s the fault ? Can anybody help me ?

You can not simply compare the characters with the integers 9 and 10. You need to declare two variables of type Char and assign them these integers. Then you can compare the variables. For example: VAR c9, c10: Char; c9 := 9; c10 := 10; WHILE (Zeile[ab + W] <> c9) …

thanks Heinz, but i’ve tried this version. I used variables instead of the signcode. It didn’t work [V] Is there another way to check the signocde ?

Stefan, I just tried my solution - it works fine. The only thing I noticed in your code snippet is that you should use COPYSTR(Zeile, ab, W); instead of W - 1, otherwise the last character of the first part is lost. Just a few thoughts: I constructed my input string “artificially” by concatenating two string literals and the c9 char in between. Could it be that your input is not what you expect it to be? Did you examine your variables in the debugger or with MESSAGE statements? You could also use STRPOS to search for the separators - in this case, you would have to construct a “search string” consisting of the two characters.

the problem seemed to be that the tabulatorsign wasn’t code 9 as i expected. I changed the tabulator into an other sign and everything worked fine. The counter “W” was set wrong, you’re right. Thanks for the hint.