CF AddOrRemoveValue, want to remove the pilcrow at the beginning

Hello all,

hope you have a nice day.

I have incorporated the AddOrRemoveValue Custom Function in my project. Thing is, when you add the first member in a list, the first character is return. I would like to remove this character, which is easy using Right(). But before I check - hum I try - if the first character is a return using Left(). This is the code:

If [ Code ( Left ( $$ListeCobinaisonAct ; 1 ) ) = 13 ]
Set Variable [ $$ListeCombinaisonAct; Value:Right ( $$ListeCombinaisonAct ; Length ( $$ListeCombinaisonAct ) - 1) ]
End If

That does not catch the return, in this case it's understandable, but it also fail with

= Code("¶")
= Char(13)

How can I check for return ? I work on a Mac, but the target is iPadOS.


How about this instead: Check the first value instead. The first character is a return (or newline or any other paragraph character) if the first value is empty.

If (
	IsEmpty (GetValue ($list; 1));
	RightValues ($list; ValueCount ($list) - 1);

Hope this helps.

1 Like

That does the job ! I alsoI have this line

Set Variable [ $$CombinaisonAct; Value:Substitute ( $$ListeCombinaisonAct ; ¶ ; "," ) ]

I wish to have the values in the list separated by ',' to display the values on a single line, and it works, I get a coma after the last value. Looks like Substitute() understands . Strange...

You can handle both tasks at the same time by using "guard rails" around your text. Simply add a low ascii character to both ends of the text. You then replace the combination of the guard rail and the return character, replace the guard character (in the case where the first or last character isn't a return), then add your commas.

Let ( $list = char(8) & "¶a¶b¶c¶d¶" & char(8) ; Substitute ( $list ; [ char(8) & ¶ ; ""] ; [ ¶ & char(8) ; ""]   ; [ char(8) ; ""]  ; [ ¶ ; ","] ) )

---> a,b,c,d
1 Like