Escape characters?

#1

Is it possible to use escape chars such as new line and tabulation? For example:

Currently Concatenate("a","\n","b") returns

a\nb

Expected would be

a
b
#2

A possible alternative would be to use Unicode characters instead. For that, you would do something like this:

Concatenate("a",Character(10),"b")

In Unicode, the tenth character is newline, so that should output correctly :+1:

If you need it to be a “\n” style newline, I’m not sure. FWIW, it doesn’t appear to be possible to use Regex style escape characters, even within a Regex. For example, I had thought you might be able to do this using the following formula:

RegexReplace(Concatenate("a","\n","b"),"(\\n)","\n")

But it doesn’t work. Perhaps someone else knows why/if, but hopefully the other solution is valid :blush:

1 Like
New Line in FormulaMap
#3

Unfortunately, Character(10) returns a simple space. I tried many different versions of unicode new line too (https://en.wikipedia.org/wiki/Newline#Unicode), both hex and decimal. Some of them output a box, others nothing at all.

#4

@Dalmo_Mendonca @Murray_Adcock

It never worked before, but I just tried it and it worked for me.

#5

@Ander

Ok now that you said it worked I just went back and tested again… and nothing. BUT…

Then I tested it inside a cell and it worked! Character(9) also works for tabulation.

1 Like
#6

@Dalmo_Mendonca

Yeah, I was only testing in a cell. I think they must have tweaked this Character() formula or something.

The hack I was using was slow to work with and didn’t copy/paste, so I’m glad Character(10) now gets the job done!

As @Murray_Adcock said: “:+1:” !

1 Like
#7

Sorry, should have specified that I was working in a cell, glad you got it working :blush:

#8

Thanks Murray. It’s only half working, but does the job with a single cell simple table.

Maybe the admins could move this to the suggestion box to implement parsing special chars in regular text?

1 Like
#9

Thanks @Dalmo_Mendonca for the suggestion. Moved it to the suggestion box and added it to our request tracker.

#10

Out of interest, am I correct in saying that you can’t use special chars on the right hand side of a RegEx in Coda? That might provide a separate solution if it did work.

#11

This method worked well for me on Mac.

  1. In a cell, I pasted a paragraph without any new lines. I then, within that cell, cursored to the end of the first sentence, just to the right of the period. I then tapped ctrl+return.

  2. Although it looks like there is a newline with no space between, I highlight from the right of the period of the first sentence until I reached to left of the capital letter of the following sentence.

  3. Copy this invisible space. It contains whatever “character” is recognized in Coda as “New Line”. I pasted this ghost character in between the quotes of the Find("", Note) formula. It worked perfectly returning the index of the first new line.