Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better support for international characters

  • Loading branch information...
commit 51dd56929056e52ac7b5646afce258a98e998869 1 parent 8140902
@magnars authored
Showing with 11 additions and 8 deletions.
  1. +8 −5 dev/examples.el
  2. +3 −3 s.el
View
13 dev/examples.el
@@ -220,7 +220,8 @@
(s-capitalized? "I am capitalized") => t
(s-capitalized? "I Am Titleized") => nil
(s-capitalized? "lower") => nil
- (s-capitalized? "UPPER") => nil)
+ (s-capitalized? "UPPER") => nil
+ (s-capitalized? "Привет") => t)
(defexamples s-numeric?
(s-numeric? "123") => t
@@ -290,15 +291,15 @@
=> "help nic! I'm on fire"
;; Replacing case has no effect on s-format
- (let ((case-replace t))
+ (let ((case-replace t))
(s-format "help ${NAME}!" 'aget '(("NAME" . "Nick"))))
=> "help Nick!"
- (let ((case-replace nil))
+ (let ((case-replace nil))
(s-format "help ${NAME}!" 'aget '(("NAME" . "Nick"))))
=> "help Nick!"
- (let ((case-replace nil))
+ (let ((case-replace nil))
(s-format "help ${name}!" 'aget '(("name" . "Nick"))))
=> "help Nick!"
@@ -337,7 +338,9 @@
(s-split-words "under_score") => '("under" "score")
(s-split-words "some-dashed-words") => '("some" "dashed" "words")
(s-split-words "evenCamelCase") => '("even" "Camel" "Case")
- (s-split-words "!map (fn list)") => '("map" "fn" "list"))
+ (s-split-words "!map (fn list)") => '("map" "fn" "list")
+ (s-split-words "Привет, мир") => '("Привет" "мир")
+ (s-split-words "e é è e") => '("e" "é" "è" "e"))
(defexamples s-lower-camel-case
(s-lower-camel-case "some words") => "someWords"
View
6 s.el
@@ -285,7 +285,7 @@ This is a simple wrapper around the built-in `string-match-p'."
"In S, is the first letter upper case, and all other letters lower case?"
(let ((case-fold-search nil))
(s--truthy?
- (string-match-p "^[A-ZÆØÅ][^A-ZÆØÅ]*$" s))))
+ (string-match-p "^[[:upper:]][^[:upper:]]*$" s))))
(defun s-numeric? (s)
"Is S a number?"
@@ -404,9 +404,9 @@ When START is non-nil the search will start at that index."
(defun s-split-words (s)
"Split S into list of words."
(s-split
- "[^A-Za-z0-9]+"
+ "[^[:lower:][:upper:]0-9]+"
(let ((case-fold-search nil))
- (replace-regexp-in-string "\\([a-z]\\)\\([A-Z]\\)" "\\1 \\2" s))
+ (replace-regexp-in-string "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2" s))
t))
(defun s--mapcar-head (fn-head fn-rest list)
Please sign in to comment.
Something went wrong with that request. Please try again.