ikodan Posted May 18, 2021 Report Share Posted May 18, 2021 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. Quote Link to comment Share on other sites More sharing options...
ikodan Posted May 18, 2021 Author Report Share Posted May 18, 2021 I think I found it : https://www.macros.com/helppro/Index.htm?context=1940 Is there a way to detect if a number is even or odd ? Quote Link to comment Share on other sites More sharing options...
acantor Posted May 18, 2021 Report Share Posted May 18, 2021 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 1 Quote Link to comment Share on other sites More sharing options...
Cory Posted May 18, 2021 Report Share Posted May 18, 2021 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. Quote Link to comment Share on other sites More sharing options...
ikodan Posted May 18, 2021 Author Report Share Posted May 18, 2021 It's working thank you. Is there a way to verify in a chain of caracters %all%, the chain of caracters %part% exists ? %all% : 561658748778132131561684849415313513216548749 %part% : 213156 Quote Link to comment Share on other sites More sharing options...
acantor Posted May 18, 2021 Report Share Posted May 18, 2021 If Variable %all% Contains "%part%" Text Box Display: Yes! Else Text Box Display: No! End If 1 Quote Link to comment Share on other sites More sharing options...
ikodan Posted May 18, 2021 Author Report Share Posted May 18, 2021 Ahhhh I didn't know this function ! Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.