Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

For a government document we need to parse out 4 letters from names.

1.The first letter of the last name.

This no problem.

2.If the first letter of the last name is a vowel, we need the first following vowel.

(f.i. lastname = Aguilar, 1st letter = A, 2d letter U )

3. If the first letter is a consonant, we need the first following vowel.

(f.i. lastname = Duarte, 1st letter = D, 2d letter U )

4. First letter of first name.

This is no problem.

So, 1 and 4 is no problem, but how to tackle 2 and 3.

TIA

Edited by Guest

Conditions 2 and 3 actually combine and kinda cancel each other out. No matter what, the second vowel is needed.

So it's really:

1. The first letter of the last name.

2. The first following vowel.

3. First letter of first name.

I'd suggest a recursive custom function would be needed.

  • Author

You're right with the combined 2/3 approach.

My first idea was also a CF.

I browsed the Brian Dunning CF list up and down, tried some of the example that looked close to what I need, but no luck.

Hence my posting here.

Would it be better to move this post to the custom function section ?

There's probably simpler ways of doing this, but I think it'll work...

NameCF(Name; Counter)

Let([

Pos = Case(Counter<2;2;Counter);

End = Length(Name);

Letter = Middle(Name;Pos;1) ;

ConvertName = Substitute(Name;["a";"1"];["e";"1"];["i";"1"];["o";"1"];["u";"1"]);

Letter1 = Middle(ConvertName;Pos;1)

];

Case(

Counter > End; "X";

Letter1=1; Letter;

NameCF(Name; Counter + 1)

))

You'll need to figure out how to handle the exceptions. Like the semivowels Y and W in English. Does Lord Byron get a Y or an O? And Senor Ayuda a Y or a U? And what happens to the guy with last name "Art"? Or to Mr. T? Right now, this functions will return an X for those situations.

Wouldn't something simpler like this work (and no CF needed)?

Let (

[

pos1 = Left ( LastName ; 1 ) ;

pos2 = Left ( Filter ( LastName ; "AEIOUaeiou" ) ; 1 ) ;

pos3 = Left ( FirstName ; 1 )

] ;

pos1 & pos2 & pos3

)

I don't think you are following rule #2. Still, I agree that a recursive calculation is not necessary:

Let ( [

char1 = Left ( LastName ; 1 ) ;

rest = Right ( LastName ; Length ( LastName ) - 1 ) ;

char2 = Left ( Filter ( Upper ( rest ) ; "AEIOU" ) ; 1 ) ;

char3 = Left ( FirstName ; 1 )

] ;

char1 & char2 & char3

)

I share David's concerns regarding the viability of the scheme - but hey, it's for the government...

Ah. I needed to eliminate the first letter of LastName from the vowel hunt. Yes, I missed that. BTW, nice way of eliminating the need of upper and lower within Filter()! And I wondered whether Y should be included but I figured the business can always tweak it at that point. :wink2:

  • Author

Thank you all.

Not only a specific solution but also a more general way to solve similar problems.

Great.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.