cancel
Showing results for 
Search instead for 
Did you mean: 

How do I break up a long String value into smaller String values?

Former Member
0 Kudos

Hi All,

I need to break up a long string value into smaller string values.

Suppose I have a long string variable, say aaa, having 500 characters. Lets suppose I have another normal string attribute, say bbb, under node ZZZ.

I want the long string aaa to be broken up into 5 instances of bbb each having 100 characters.

Please help me out in this regard.

Sayan Ghosh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ashwani,

Thanks for the link.. It was helpful.. But I have another problem here.. I cannot check the length of the long string. This is because the function of length() is only applicable to string variables but not with long string variables. And I firest need to know the total length of the long string value before breaking it up into smaller strings. Also the function of Substring is available for string and not for long.

Please provide a solution to this.

Regards,

Sayan

former_member186016
Active Contributor
0 Kudos

What do you mean by long string ?

Is it some long varialble ? Then use Long.toString() to convert to String. Then you can do normal operations of length() or split(...)

</message/2337783#2337783 [original link is broken]

Regards,

Ashwani Kr Sharma

Answers (1)

Answers (1)

former_member186016
Active Contributor
0 Kudos

Hi,

Use this: split method in Strings.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#split(java.lang.String)

Regards,

Ashwani Kr Sharma