1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: remove ustring (#10630)

This commit is contained in:
Daniel Däschle
2021-07-03 19:14:09 +02:00
committed by GitHub
parent 5a4a1997e7
commit 0f9537ece5
10 changed files with 56 additions and 354 deletions

View File

@ -33,11 +33,6 @@ pub fn len(s string) int {
return count
}
// u_len return the length as number of unicode chars from a ustring
pub fn u_len(s ustring) int {
return len(s.s)
}
// char_len calculate the length in bytes of a utf8 char
[deprecated: 'use builtin utf8_char_len']
pub fn char_len(b byte) int {
@ -134,23 +129,11 @@ pub fn to_upper(s string) string {
return up_low(s, true)
}
// u_to_upper return an uppercase string from a ustring
pub fn u_to_upper(s ustring) ustring {
tmp := up_low(s.s, true)
return tmp.ustring()
}
// to_lower return an lowercase string from a string
pub fn to_lower(s string) string {
return up_low(s, false)
}
// u_to_lower return an lowercase string from a ustring
pub fn u_to_lower(s ustring) ustring {
tmp := up_low(s.s, false)
return tmp.ustring()
}
/*
Punctuation functions

View File

@ -13,22 +13,11 @@ fn test_utf8_util() {
assert utf8.to_upper('абвёabc12') == 'АБВЁABC12'
assert utf8.to_lower('АБВЁABC12') == 'абвёabc12'
// ustring test
src1 := src.ustring()
upper1 := utf8.u_to_upper(src1)
lower1 := utf8.u_to_lower(src1)
assert upper1 == (src_upper.ustring())
assert lower1 == (src_lower.ustring())
// test len function
assert utf8.len('') == 0
assert utf8.len('pippo') == 5
assert utf8.len(src) == 15 // 29
assert src.len == 24 // 49
// test u_len function
assert utf8.u_len(''.ustring()) == 0
assert utf8.u_len(src1) == 15 // 29
assert utf8.u_len('pippo'.ustring()) == 5
// western punctuation
a := '.abc?abcòàè.'