Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How To Split a String at '

Former Member
0 Likes
7,727

Hi Folks,

i need to Split a String at ' obviously Split String at ''' doenst work. so how can i manage to split the string wherever a ' show up?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,695

Hi,

Try like this,


constant: c_quote value `'`.

split ... AT c_quote INTO....

Vikranth

5 REPLIES 5
Read only

Former Member
0 Likes
2,696

Hi,

Try like this,


constant: c_quote value `'`.

split ... AT c_quote INTO....

Vikranth

Read only

0 Likes
2,695

`'` -> best one

thx alot!

Read only

Former Member
0 Likes
2,695

hai,

try this code

CONSTANTS: C_COMMA(1) TYPE C VALUE ' ' ',

SPLIT V_ZTMAT_MASTER_IB AT C_COMMA INTO

V_PRDNO.

Read only

former_member222860
Active Contributor
0 Likes
2,695

You can split single (') quote as well.

data: v_str1 type string.
data: v_str2 type string.
data: v_str3 type string.
data: v_str4 type string.

v_str1 = 'Mahesh''sap''abap'.

SPLIT v_str1 at '''' INTO v_str2 v_str3 v_str4.

write:/ v_str1, / v_str2, / v_str3, / v_str4.

Read only

Former Member
0 Likes
2,695

use 4 single quotes.

data s1 type string value 'asdasdas''asd''asdasd'. " i am giving 2 single quote to pass one quote
data : s2 type string.
data : s3 type string.
data : s4 type string.

split s1 at '''' into s2 s3 s4.

write / : s1, s2,s3,s4.

and output as

asdasdas'asd'asdasd =====> this is S1

asdasdas

asd

asdasd

Edited by: Soumyaprakash Mishra on Oct 22, 2009 5:06 PM