cancel
Showing results for 
Search instead for 
Did you mean: 

Substring

Former Member
0 Kudos

Hello Gurus,

Within XI I can use the text-function substring. I can define the start en end position within the function. But I want to be able to set the start en end position dynamicly. So sometimes the start postion needs to be 1 and another time it needs to be 2. How is this possible?

Best regards,

Guido

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You may have to create a user defined fucntion for this.

I have created a "variable end" udf, but not the variable beginning.

This is the code I used..

public String SubstringWithoutLength(String a,String b,Container container){

int i = Integer.parseInt(b);

String c = a.substring(4,i);

a - valuefromidoc

b - length from length function

Answers (2)

Answers (2)

Former Member
0 Kudos

you need to create your own UserDefied function for this.

In the following example i am gettig the string and substring length. Depending on that i am returning the value. This will help you.

For example, Just check my code

   //write your code here
  int l =0; 
l = a.length();
int c= Integer.parseInt(b);
return  a.substring(l-c,l);
   //write your code here
  int l =0; 
l = a.length();
int c= Integer.parseInt(b);
return  a.substring(l-c,l);

Regards,

Vijay

prateek
Active Contributor
0 Kudos

Write ur own functinality and code in a UDF.

Regards,

Prateek