on 10-11-2011 4:17 PM
hi experts,
my input field value length is 2000 characters.
but my question is how to split the 2000 characters in to several segment example in 70 characters in one segment like that
Hi Pratima.
You can use this UDF code
public static void splitBySize(String inputList[], String sizeSplit[],
int targetLen = 0;
int sourceLen = 0;
int count = 0;
int pos = 0;
for(int i = 0; i < inputList.length; i++)
{
if(i < sizeSplitList.length)
targetLen = Integer.parseInt(sizeSplit<i>);
sourceLen = inputList<i>.length();
count = sourceLen / targetLen;
for(pos = 0; pos < count * targetLen; pos += targetLen)
result.addValue(inputList<i>.substring(pos, pos + targetLen));
if(pos < sourceLen)
result.addValue(inputList<i>.substring(pos));
Where inputList...-- The values of Segment
sizeSplit...-- The value of Split.(in your case 70)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use substring java string method using UDF to achieve this
Example:
String str ="123434";
String str2 = str.substring(2,str.length());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.