Jump to content
Macro Express Forums

Process a string, in order to analyse the rythm of a text ?


Recommended Posts

Hello,

 

I have a string, for exemple :

%string% = "This is a sentence, I want to analyse the rythm."

 

Is there a way to put each caracter in an array like : %s_letter[%n%]% ? 

%s_letter[1]% = T

%s_letter[2]% = h

%s_letter[3]% = i

%s_letter[4]% = s

 

Because I want to make a macro that analyse in all ways a text, for "This is" :

consonant vowel Th i s i s = 2 1 1 1 1

letters in words : This is = 4 2
uppercase : T hisis = 1 5

letters between the ponctuation : "This is a sentence, I want to analyse the rythm." = 15 22

etc...

 

Thank you for help. 

Link to comment
Share on other sites

There are many ways to test for evenness / oddness, including this:

 

Variable Set Decimal %Value%: Prompt
Variable Modify Decimal: %HalfValue% = %Value% / 2
Variable Modify Decimal %HalfValue%: Remove Integer Portion (%DecimalsOnly%)
If Variable %DecimalsOnly% Equals "0"
  Text Box Display: Even
Else
  Text Box Display: Odd
End If

 

  • Like 1
Link to comment
Share on other sites

Truncate to Integer also works. There are many ways to do it. But I like acantor's method best. It's essentially like how I woudl use the modulus function in .NET. 

I also recommend making this a macro you can use as a function with Macro Run. Call it "Is Even" or something and return a Boolean. Anytime I have somehting like this which is an isolated nugget of functionality I make it a small macro I can use anytime as a subroutine or function. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...