Filter percentage out of string

ReSpongebob
Member Posts: 17
Hi,
I would like to filter a percentage out of a string.
Example:
String: This ring is made of 15% pure gold
The result I need:
Var1: This ring is made of pure gold
Var2: 15%
Thanks in advance!
I would like to filter a percentage out of a string.
Example:
String: This ring is made of 15% pure gold
The result I need:
Var1: This ring is made of pure gold
Var2: 15%
Thanks in advance!
0
Comments
-
have you tried using copystr (copy part of the string) and strpos (find first position of a given substring)?Navision developer0
-
Thanks for the reply.
I'm rather new to Navision and I don't know how I can filter a subset (0..9 |%|,) out of a string-variable.0 -
Hi
You could code it like thisText := 'this ring is made of 10% pure gold'; Text3 := Text; WHILE STRPOS(Text3,'%') > 0 DO BEGIN Text3 := COPYSTR(Text3,STRPOS(Text3,' ') + 1); i := STRPOS(Text3,'%'); IF (i < 6) AND (Text2 = '') THEN BEGIN Text2 := DELCHR(COPYSTR(Text3,1,i),'<>',' '); j := STRLEN(Text2); END; END; i := STRPOS(Text,'%'); Text1 := COPYSTR(Text,1,i - j) + COPYSTR(Text,i + 2); MESSAGE('text = %1\Txt1 = %2\Txt2 = %3',Text,Text1,Text2);
Albert0 -
Thanks a lot.
=D>0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions