2007 Oct 23 6:48 AM
Hi there,
If given string contains a special character in the first position..i need to delete the character from the string.
please suggest a way..
Hi there,
If given string contains a special character in the first position..i need to delete the character from the string.
please suggest a way..
2007 Oct 23 6:51 AM
Hi Tuborg,
Use offset to delete it.
Refer this seudo code :
data : d_string type string value '@abcdef'.
d_string = d_string+1(6).
Regards,
Hemant
2007 Oct 23 6:51 AM
if str+0(1) eq 'your_special_character>'.
str+0(1) eq ' '.
shift str left deleting leading space.
endif.
2007 Oct 23 6:52 AM
creaate a range containing all the alphabets.. both small n capital...
data: str1(10).
if str1+0(1) NOT IN range.
SHIFT str1 BY 1 PLACES LEFT.
endif.
2007 Oct 23 6:54 AM
hi
good
use strlen and get the length of the string than delete the first letter as per the position starting from 0,
thanks
mrutyun^
2007 Oct 23 6:54 AM
It's clunky, but try this:
To replace special character with space.
data: w_val type string.
move old_string+0(1) to w_val.
replace first occurance of w_val in old_string with space.
OR
To remove it entirely
shift old_string by 1 places left. " Shifts string to left and drops off characters to left.
Steve
2007 Oct 23 6:59 AM
thanks.
but not always the first char will be the special char..How to check the first char is the special char?
2007 Oct 23 7:12 AM
2007 Oct 23 7:17 AM
by creating a range of the aplhabets .. you are defining all the non-special characters...
as you cant possibly list down all the characters...
so in the condition check if string+0(1) i.e. 1st char of string is ther in the range or not..
if not in the range... that is your special character... remove it
2007 Oct 23 7:21 AM
if str+0(1) eq 'your_special_character>'.
str+0(1) eq ' '.
shift str left deleting leading space.
endif.
str+0(1) checks only da first character. if it is special character it 'll delete it else da string 'll remain same.
try da code n den leme kno if its working or not
2007 Oct 23 7:20 AM
Hi,
If you knw the Ascii codes, then its pretty simple:
if string+0(1) GE 65 and string+0(1) LE 91.
...
endif.Best regards,
Prashant
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |