You need to sign in to do that
Don't have an account?
ramm12
String concatination help urgent...!
hi experts,
I have a string like below,
String s = '(1 OR 2) or 3';
so the above string contains numbers i.e 1,2,3. If number contains means i need to get string like below using apex code,
String s = '(1# OR 2#) or 3#';
Any help much appreciated...!
Thanks in advance...
I have a string like below,
String s = '(1 OR 2) or 3';
so the above string contains numbers i.e 1,2,3. If number contains means i need to get string like below using apex code,
String s = '(1# OR 2#) or 3#';
Any help much appreciated...!
Thanks in advance...
s.replace ('1', '1#''); and repeat from 0 to 9;
although if you have number 10 it wont help
Ta
Vish
String s = '(1 OR 2) or (3 AND 4) Or (5 AND 6)';
In like above case i need to do like hardcoding replace('1','1#').
so how to avoid
Try this,
you can split the string by this way..
string[] a = 'aaa21h32j2'.split('(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)');
system.debug('#####'+a);
OUTPUT : #####(aaa, 21, h, 32, j, 2)
so after this use loop and check whether a[0] is string or integer if integer add # or any other as you wish. Finaly add all to string.
eg:
a[0] is integer then a[0]=a[0]+'#';
Mark this as best answer if its helps.
Thanks.