08-27-2023 12:30 AM
Hello. I'm trying to make a program that will give an ID once you enter your data, problem here it's I need to find the first internal consonants of the surname and name, but I'm really having trouble with it. I already tried to do it with a match pattern, so it'll give all the consonants from the string and then I tried to use a subset string to grab the letter from a given position, but problem here it's when the name starts with a consonant, it will show the first one instead of the internal one. I'm really lost at this one. This is what I've accomplished so far.
Solved! Go to Solution.
08-27-2023 03:08 AM
Your code does do a considerable part of the work and could be modified relatively simply to find the first "internal" consonant (for instance, by searching the original string for the vowels and seeing if the first match is at index zero), but it also has a bunch of issues, some more serious than others:
There are probably others, too.
Your code doesn't actually show a Match Pattern function, unlike your description. If you did use a Match Pattern, you would probably find it easier (with something like [B-Db-dF-Hf-h], etc.).
It also helps to include actual code with good default values for testing as well as what you expect to see and what you actually see and try to backsave it to earlier versions of LV
08-27-2023 10:45 AM
In addition to the above comments that you should read carefully:
@ACMontez wrote:
Hello. I'm trying to make a program that will give an ID once you enter your data, problem here it's I need to find the first internal consonants of the surname and name, but I'm really having trouble with it. I already tried to do it with a match pattern, so it'll give all the consonants from the string and then I tried to use a subset string to grab the letter from a given position, but problem here it's when the name starts with a consonant, it will show the first one instead of the internal one. I'm really lost at this one. This is what I've accomplished so far.
Please attach a simplified version of your code containing all data entry fields. Make sure the string controls are set to "limit to single line". Fill all controls with default data and tell us what ID you would expect for correctly working code. Make sure the surname starts with a consonant to properly test that scenario.
08-27-2023 09:45 PM - edited 08-27-2023 09:46 PM
I'm going to tell what I'm trying to get here, so maybe that will cover all your questions.
What I'm trying to replicate it's to obtain the CURP, which it's a unique identification code used in Mexico to keep track of individuals for various administrative and official purposes. Like the Social Security Number in the US. The CURP it's a 18-character alphanumeric code that is generated based on full name, date of birth, gender, and place of birth.
The last three letters are obtained from the name and the surname, using the internal consonants from it. For example, if someone it's called James Jones, the first internal consonants will be M and N, but if the name would be something like Andrew Anderson, the first internal consonants, in both cases would be an N, which it's basically what I'm trying to achieve.
That's why I'm forcing it to be all capital letters, because that's how the CURP works as well. Hope this helps.
08-28-2023 12:44 AM
Hi AC,
@ACMontez wrote:
The last three letters are obtained from the name and the surname, using the internal consonants from it. For example, if someone it's called James Jones, the first internal consonants will be M and N, but if the name would be something like Andrew Anderson, the first internal consonants, in both cases would be an N, which it's basically what I'm trying to achieve.
What is the 3rd char?
To find "internal" consonants:
Now you have the "internal consonants" of the word…
08-28-2023 04:21 AM - edited 08-28-2023 04:22 AM
I'd read this first (same class?):
Solved: write a character string and find the number of vowels in it - NI Community
If you set the search and replace string function to match regular expressions (right click it), you can be much more expressive in your search.
08-28-2023 03:43 PM
1. Names with 2 words, use the second name in orden to get the consonant from It.
2. How can I do such thing? I already got the first letter from the word, but it's a there a function to delete It or change It from some other caracter?
08-28-2023 04:24 PM
String Subset will let you strip the first letter:
08-29-2023 02:53 AM
@ACMontez wrote:
1. Names with 2 words, use the second name in orden to get the consonant from It. How can I do such thing?
Either split up functionality (get all words, process words individually) or come up with a clever reg.ex. and execute it until there are no more matches.
@ACMontez wrote:2.I already got the first letter from the word,
If you post what you have, we could actually reflex on that...
@ACMontez wrote:but it's a there a function to delete It or change It from some other caracter?
Replace Substring...
Search And Replace String...
Match Pattern Expression and a Concatenate String...
Match Regular Expression and a Concatenate String...
2X Search/Split String and a Concatenate String...
2X Strings Subset and a Concatenate String...
Infinite combinations of most string functions allow doing this.
I'm not sure why you'd want to replace strings if your goal is to find consonants.
Post what you have.
08-29-2023 09:35 AM
I haven't seen a solution yet, this is one way: