Jump to content

wildcards? scripts


zyakobu
 Share

This topic is 5786 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I have a list of words that I need to manipulate in two different ways.

In order to do what I need, it seems that I need wildcards, but i can't use them inside formulae, because FM just reads the wildcard characters as what they are, not as wildcards, in this instance.

What I am trying to do is the following (where "?" is wildcard):P

  • IF (word ends with "e?") THEN (add "i" to end of word)
  • IF (word ends with "o?") THEN (add "u" to end of word)
  • IF (word ends with "a?") THEN (add "ı" end of word)
  • etc

For example: I want to change input "bet" to "beti" , but "bot" to "botu" , etc.

Without wildcards, this is impossibly tedious. Any suggestions?

-Zyakobu

Link to comment
Share on other sites

As far as I can remember the ? as a wildcard represents one character. In that case does this work:

If [ Right ( yourFile::theWord; 2) = "e" ]

Set Field [ yourFile::theWord; yourFile::theWord & "i" ]

Else If [ Right ( yourFile::theWord; 2) = "o" ]

Set Field [ yourFile::theWord; yourFile::theWord & "u" ]

Else If [ Right ( yourFile::theWord; 2) = "a" ]

Sorry, can't get the post to retain the indentation,

Norman

Set Field [ yourFile::theWord; yourFile::theWord & "i" ]

End If

Link to comment
Share on other sites

If [ Right ( yourFile::theWord; 2) = "e" ]

I am afraid the only time that condition is going to return true is when theWord itself is "e".

Zyakobu:

There are no wildcards in a calculation, but they are not needed. Since you only care about the character before last, you can address it directly, ignoring everything else:

Let ( [

pos = Length ( word ) - 1 ;

char = Middle ( word ; pos ; 1 ) ;

add = Case (

char = "e" ; "i" ;

char = "o" ; "u" ;

char = "a" ; "ı"

)

] ;

word & add

)

Link to comment
Share on other sites

This topic is 5786 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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