COMMON: Add String::forEachLine and convertBiDiStringByLines #2779
Conversation
Have you looked at |
Well, I wasn't aware of However, I have checked it now, and indeed, it's a handy function, but not equivalent to Therefore, the succinct
in this PR would be longer, had I used |
`convertBiDiStringByLines` calls the BiDi algo for each line in isolation, and returns a joined result. That's needed to support BiDi in AGI, and might be needed for other engines in the future. In order to do that, a new utility function was added: `String::forEachLine` which gets a function as input, and its arg(s) (if it has any), and calls the function on each line, and returns a new string which is all concactination of all the lines results (with '\n' added between them)
BTW, another example of
|
convertBiDiStringByLines
calls the BiDi algo for each line in isolation, and returns a joined result.That's needed to support BiDi in AGI, and might be needed for other engines in the future.
In order to do that, a new utility function was added:
String::forEachLine
which gets a function as input, and its arg(s) (if it has any), and calls the function on each line, and returns a new string which is all concatenation of all the lines results (with '\n' added between them).