Re: D-ish way to work with strings?

2019-12-27 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Dec 27, 2019 at 01:23:57PM +0100, Robert M. Münch via Digitalmars-d-learn wrote: > On 2019-12-23 15:05:20 +, H. S. Teoh said: [...] > > What are you planning to do with your strings? > > Pretty simple: Have user editable content that is rendered using > different fonts supporting

Re: D-ish way to work with strings?

2019-12-27 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-23 15:05:20 +, H. S. Teoh said: On Sun, Dec 22, 2019 at 06:27:03PM +0100, Robert M. Münch via Digitalmars-d-learn wrote: Want to add I'm talking about unicode strings. Wouldn't it make sense to handle everything as UTF-32 so that iteration is simple because code-point =

Re: D-ish way to work with strings?

2019-12-27 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-12-22 18:45:52 +, Steven Schveighoffer said: switch to using char[]. Unfortunately, there's a lot of code out there that accepts string instead of const(char)[], which is more usable. I think many people don't realize the purpose of the string type. It's meant to be something that

Re: D-ish way to work with strings?

2019-12-23 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Dec 22, 2019 at 06:27:03PM +0100, Robert M. Münch via Digitalmars-d-learn wrote: > Want to add I'm talking about unicode strings. > > Wouldn't it make sense to handle everything as UTF-32 so that > iteration is simple because code-point = code-unit? > > And later on, convert to UTF-16

Re: D-ish way to work with strings?

2019-12-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/22/19 9:15 AM, Robert M. Münch wrote: I want to do all the basics mutating things with strings: append, insert, replace What is the D-ish way to do that since string is aliased to immutable(char)[]? switch to using char[]. Unfortunately, there's a lot of code out there that accepts

Re: D-ish way to work with strings?

2019-12-22 Thread Robert M. Münch via Digitalmars-d-learn
Want to add I'm talking about unicode strings. Wouldn't it make sense to handle everything as UTF-32 so that iteration is simple because code-point = code-unit? And later on, convert to UTF-16 or UTF-8 on demand? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

D-ish way to work with strings?

2019-12-22 Thread Robert M. Münch via Digitalmars-d-learn
I want to do all the basics mutating things with strings: append, insert, replace What is the D-ish way to do that since string is aliased to immutable(char)[]? Using arrays, using ~ operator, always copying, changing, combining my strings into a new one? Does it make sense to think about