Home > Net >  Is it fine to assume all Android devices in this world are using "\n" as line separator c
Is it fine to assume all Android devices in this world are using "\n" as line separator c

Time:10-11

I know that Android is built on Linux kernel and Linux is using "\n" as line separator character.

Is it Ok to assume

System.getProperty("line.separator") == "\n"

hold true for all all Android devices in this world?

Will there ever be any edge case where "\n" is not used as line separator character in some rare Android device?

Reason I am asking so because our one sharable data need to be shared across many Android devices. I need to ensure data, which uses "\n" as its line separator character, can be recognized by all Android devices.

Thanks.

CodePudding user response:

Technically no, in practice yes. Android is built on Linux, and the terminator on Linux (and all other Unix like OSes) is \n.

Theoretically they could change the underlying kernel to something completely different that changes the line separator. But realistically that's not going to happen. If it does, you'll hear about it years ahead of time because the switch will take years to code. And even if they do, it would be more likely the continued to use \n because changing it would bring no value. So I would go ahead without worrying about it.

CodePudding user response:

Why are you only talking about a device?

Its the apps that decide which line separator to use.

Every app can do what it wants.

  • Related