on 09-23-2009 12:24 PM
Hi,
I have a field which has 008.2009.
I need to extract the contents before DOT character or just ignore the contents after DOT character.
Used replace string function but just replaces the DOT character with space.
Without UDF, let me know whether it is possible using std functions.
Regards
Krish
Is your requirement just to get 008 in the target field?
If yes then this can be achieved using the IndexOf function and then based on the value returned by the IndeOf function do a substring and have only the part before dot.
If above is the requirement then it can be easily achieved using a UDF....a very simple UDF.
Update:
I dont think standard functions will help.....the substring function will need the ending location of the string (in your case 8)....this is actually passed as length....hence UDF is required....any specific for avoiding UDF?
Regards,
Abhishek.
Edited by: abhishek salvi on Sep 23, 2009 5:00 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is not possible without UDF, you need to use simple udf code for this.
Parameter = String.
char[] temp1 = new char[inputfield.length+1];
char[] temp = new char[inputfield.length+1];
temp = inputfield.toCharArray();
for(int i=0; temp.length()>i;i++)
{
temp1<i> = temp<i>;
if(temp<i>.equals('.'))
break;
result.addValue(String.valueof(tem1p<i>));
}
Thanks
Swarup
Thanks
swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
create a UDF with one argument a
return a.substring(0, a.indexOf("."));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Map Like this..
input---->UDF---->Output
UDF Code is
return a.substring(0,a.indexOf('.'));
Only one line code...
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it is not possible with the standard function you have to use UDF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krish,
If the dot always appears after three digits (numbers) then you can use the substring function.
Using substring you can get numbers before dot (008).
UDF is not required to achieve this if the DOT always appears after three digits.
Let me know what output string do you exactly need?
Regards,
Gautam Purohit
Edited by: Gautam Purohit on Sep 23, 2009 1:32 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.