Click here to Skip to main content
15,912,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to split ABCDE0060GHIJKL037Mxxx convert this string into the following format according to database value

The formatted String code is
ABCDE 0060 GHIJ KL 037 XXX

condition is
1) It checks whether ABCDE is store in database or not if present then change that ABCDE to XXXXX same for remaining string.
Posted
Updated 29-Dec-14 22:02pm
v2
Comments
Arjsrya 30-Dec-14 4:14am    
few doubts - how many characters will be there? is it constant?
Member 11270220 30-Dec-14 4:15am    
no string length will be 15 or more.....I want to convert that string according to users input.....
OriginalGriff 30-Dec-14 4:23am    
And?
What have you tried?
Where are you stuck?
What language are you using?
What help do you need?
Praveen Kumar Upadhyay 30-Dec-14 4:25am    
So it's like split first 5 character then 4,4,2,3 and 3 character??
Member 11270220 30-Dec-14 4:25am    
not tried anything but confused from where to start and how this will happen....want guidance for converting that type of string according to database value

1 solution

you can use Substring Like this ..
C#
str = "ABCDE 0060 GHIJ KL 037 XXX ";
       retString = str.Substring(0, 5);
 
Share this answer
 
Comments
Member 11270220 30-Dec-14 6:18am    
ya used but now want to check ABCDE and 0060 substring value with database value....how to do that
Amresh Bahadur Singh 30-Dec-14 6:25am    
after that you can pass these values in Store procedure and check condition using like keyword
Member 11270220 30-Dec-14 6:26am    
but keywords are more than 100 then how to do that??
Amresh Bahadur Singh 30-Dec-14 6:30am    
your The formatted String code length is fix or not ?
Member 11270220 30-Dec-14 6:30am    
formatted string code length is 12

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900