Hi all,
I have record Name and record Surname in a form
I have to get three consonants both from Name and Surname and put them in a filed in the form.
E.g.
Name : Luciana
Surname Rossi
Result: LCN RSS
Which function can I use?
Hi all,
I have record Name and record Surname in a form
I have to get three consonants both from Name and Surname and put them in a filed in the form.
E.g.
Name : Luciana
Surname Rossi
Result: LCN RSS
Which function can I use?
Hi Luciana,
what should happen when there are more then three consonants in your string?
Eg:
Name: Lucianax
Surname: Rossix
Result: LCN RSS or LCX RSX or another combination?
Regards
Jan
Only LCN and RSS.
The algorithm is:
look at the name (or the surname) and take first, second and third consonant that you’re able to find.
Ok, then basically it should work like this:
for i := 1 to strlen(YourString) do begin
CheckString := Copystr(Yourstring,i,1);
if strpos(‘QWRTZPSDFGHJKLYXCVBNM’,uppercase(CheckString)) <> 0 then
NewString := NewString + Checkstring;
if strlen(NewString) = 3 then
i := 10000;
end;
Regards Jan
I love you
Awsome! It works! Thank you very very much!
I don’t understand only a thing: why i:= 1000?
What about this code?
FirstName := ‘Luciana’;
LastName := ‘Rossi’;
NewString := UPPERCASE(DELCHR(STRSUBSTNO(’%1 %2’,FirstName,LastName),’=’,'aeiouyAEIOUY '));
@Luciana, glad I could help. The “i := 10000” is there to end the loop (so we don’t add more then three Characters)
@Luc, looks cool
Both solutions will work, although Luc’s needs a little modification.
NewString := COPYSTR(UPPERCASE(DELCHR(FirstName),’=’,‘aeiouyAEIOUY ‘), 1, 3) +
COPYSTR(UPPERCASE(DELCHR(SurName),’=’,'aeiouyAEIOUY '), 1, 3);
Personally I like the one above, but Jan’s is more “readable” I suppose.
You may also need to consider removing other characters. There are plenty of names that have an apostrophe in them for example. Oh a hyphen / dash.
Is ‘Y’ a vowel or consonant?
For me it’s a consonant but maybe that’s my german prononcation
As the saying goes in the US…a, e, i, o, u…and sometimes y. [:)]
this post is FUN and COOL. it’s creative … you are all just … WOW!
Thanx Matt for your adjustment. I had pasted my solution into my reply and had to go and thought, oops forgotton to take into account the requirement of only 3 vowels consonants.
Agree (and thanx).
In general in NAV we tend to approach strings as a whole (using the various string manipulation functions) and not as an array of characters. That’s why I gave my solution (and Matt made it better).