Module: UTF8Proc::StringExtension
- Included in:
- String
- Defined in:
- ext/utf8_proc/utf8_proc.c
Instance Method Summary collapse
- #NFC ⇒ Object
- #NFD ⇒ Object
- #NFKC ⇒ Object
- #NFKC_CF ⇒ Object
- #NFKD ⇒ Object
- #normalize(*args) ⇒ Object
Instance Method Details
#NFC ⇒ Object
41 42 43 |
# File 'ext/utf8_proc/utf8_proc.c', line 41 static VALUE StoNFC(VALUE string) { return normInternal(string, UTF8PROC_STABLE | UTF8PROC_COMPOSE); } |
#NFD ⇒ Object
51 52 53 |
# File 'ext/utf8_proc/utf8_proc.c', line 51 static VALUE StoNFD(VALUE string) { return normInternal(string, UTF8PROC_STABLE | UTF8PROC_DECOMPOSE); } |
#NFKC ⇒ Object
61 62 63 |
# File 'ext/utf8_proc/utf8_proc.c', line 61 static VALUE StoNFKC(VALUE string) { return normInternal(string,UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_COMPAT); } |
#NFKC_CF ⇒ Object
81 82 83 |
# File 'ext/utf8_proc/utf8_proc.c', line 81 static VALUE StoNFKC_CF(VALUE string) { return normInternal(string, UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_COMPAT | UTF8PROC_CASEFOLD); } |
#NFKD ⇒ Object
71 72 73 |
# File 'ext/utf8_proc/utf8_proc.c', line 71 static VALUE StoNFKD(VALUE string) { return normInternal(string, UTF8PROC_STABLE | UTF8PROC_DECOMPOSE | UTF8PROC_COMPAT); } |
#normalize(*args) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'ext/utf8_proc/utf8_proc.c', line 116
static VALUE StoNorm(int argc, VALUE* argv, VALUE string){
VALUE form;
rb_scan_args(argc, argv, "01", &form);
if (NIL_P(form)) {
return StoNFC(string);
}
ID s_form;
s_form = SYM2ID(form);
if (s_form == NFC) {
return StoNFC(string);
}else if(s_form == NFD) {
return StoNFD(string);
}else if(s_form == NFKC) {
return StoNFKC(string);
}else if(s_form == NFKD) {
return StoNFKD(string);
}else if(s_form == NFKC_CF) {
return StoNFKC_CF(string);
}else{
rb_raise(rb_eArgError, "%s",
"Argument must be one of [:nfc (default), :nfd, :nfkc, " \
":nfkd, :nfkc_cf]");
}
}
|