Newbies zyakobu Posted November 23, 2006 Newbies Posted November 23, 2006 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) 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
normanicus Posted November 23, 2006 Posted November 23, 2006 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
comment Posted November 23, 2006 Posted November 23, 2006 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 )
Recommended Posts
This topic is 6574 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 accountSign in
Already have an account? Sign in here.
Sign In Now