Main Page
Contents
- String Types
- Char Operations
- String Creation and Concatenation
- String Conversion
- String Testing
- String Indexing
- String Interpolation
- String Comparison
String
String Types
Matlab (2020b) | Julia (1.6) | Notes |
---|---|---|
char |
Char |
|
string |
String |
Char Operations
Matlab (2020b) | Julia (1.6) | Notes |
---|---|---|
c = 'hello' |
c = ['h', 'e', 'l', 'l', 'o'] |
|
d = double(c) |
d = Float64.(c) |
|
a = char(d) |
a = Char.(d) |
|
'x' - 'a' |
'x' - 'a' |
Result: 23 |
'A' + 1 |
Int('A' + 1) |
Result: 66 |
char('A' + 1) |
'A' + 1 |
Result: 'B' |
'A' <= 'X' <= 'Z' |
'A' <= 'X' <= 'Z' |
Result: true |
"A" <= "X" <= "Z" |
'A' <= 'X' <= 'Z' |
Result: true |
String Creation and Concatenation
Creation
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Repetition
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String Concatenation
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Join
Result "applesbananaspineapples". Matlab default delimiter is " ". Julia default delimiter is ""
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Result "apples bananas pineapples". Matlab default delimiter is " ". Julia default delimiter is ""
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Result: "apples, bananas, pineapples"
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Result: ["apples + bananas + pineapples"; "aa + bb + cc"]
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Not straight forward in Julia
Matlab (2020b) | Julia (1.6) |
---|---|
|
Not straight forward in Julia |
String Conversion
String to char array
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Char array to string
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String to number
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Number to string
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String to character code
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String Testing
String length
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Contains
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String Indexing
Choose n-th character, ASCII
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Choose n-th character, Unicode
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Iterate each character
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String Interpolation
In place calculation
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Using compose
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Using join
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
String Comparison
Simple comparison
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Equality / Inequality, case sensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Equality, case insensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Equality first n character, case sensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Equality first n character, case insensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Match array of string to a string, case sensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Match array of string to a string, case insensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|
Match array of string to multiple strings, case sensitive
Matlab (2020b) | Julia (1.6) |
---|---|
|
|