cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert XSD:String type to an array

Former Member
0 Kudos

Java Experts,

How to convert XSD:String type as an input variable to an array in UDF?

Thanks!

MP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I choose the option to 'Queue' for UDF.

public void test2(String[] inputList,ResultList result,Container container){

int charLimit = 132;

char[] stringTochars = inputList.toCharArray();

boolean endOfString = false;

int start = 0;

int end = start;

while(start < stringTochars.length-1) {

int lastSpace = 0;

for (int charCount = 0 ; charCount < charLimit ; charCount++) {

if(stringTochars[charCount+start] == ' ') {

lastSpace = charCount;

}

if(charCount+start == inputList.length()) {

endOfString = true;

break;

}

}

if (endOfString) {

end = inputList.length();

} else if (lastSpace > 0) {

end = lastSpace+start;

} else {

end = charCount+start;

}

result.addValue(inputList.substring(start, end));

start = end+1;

}

}

I am getting syntax error as follows:

cannot resolve symbol symbol : method toCharArray () location: class java.lang.String[] char[] stringTochars = inputList.toCharArray();

Thank you,

MP

Former Member
0 Kudos

Hi MP,

Well, It is not necessary convert the string array as char array, Use only "inputList" for your iteration, It is an array.

Regards

Ivan

Former Member
0 Kudos

Hi MP

Why do you ned to convert to char?

You can use inputList [] is an array.

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks Jose... It worked!!

Former Member
0 Kudos

Hi MP

Can you explain more clearly?. All pararameters are in String.

if you want to receive as an array choose the option en Queue in your UDF.

Former Member
0 Kudos

Hi MP,

While creating the UDF, you chose the Execution Type as "All Values of Queue".

Best Regards,

Nitin

Former Member
0 Kudos

Hi,

What do you want to do exactly? pls, give us more details.

Regards

Ivan