-
Notifications
You must be signed in to change notification settings - Fork 3
Home
aa1024 edited this page Jun 10, 2018
·
4 revisions
String helper functions - flip case, space fill, zero fill, camelcase, uncamelcase, underscore separated, snakecase, startcase, traincase
startcase "an example string" -> "An Example String"
param x: | String |
---|
q).str.stc"start-case string"
Snakecase : underscore separated text , but the case is preserverd
param x: | String |
---|---|
returns: | underscore separated text without any case changes. |
q).str.sc "An example of Snake case"
Traincase : hyphen separated text , but the case is preserverd
param x: | String |
---|---|
returns: | hyphen separated text without any case changes. |
q).str.tc"An example of Train case"
Camel case to lower case underscore separated
param x: | String in camel case form or space separated |
---|---|
returns: | underscore separated text |
q).str.us"spaceSeparated text"
To camel case
param x: | String containing underscores, hyphens or spaces |
---|---|
returns: | Camel case string |
q).str.cc"underscore_separated_text"
Uncamelcase - Camel case to space separated text , case is preserved
param x: | Camel case string |
---|---|
returns: | Space separated string |
q).str.ucc"addSpaceInCamelCase"
Swap/Flip case
param x: | String |
---|---|
returns: | String with case swapped |
q).str.fc"FlipCase"
Space fill
param x: | int |
---|---|
param y: | String |
returns: | String left padded with space |
q).str.sfl (3;12)
Space fill from right
param x: | int |
---|---|
param y: | String |
returns: | String right padded with space |
q).str.sfr (3;12)
Space fill from left for list of strings
param x: | int |
---|---|
param y: | String |
returns: | String left padded with space |
q).str.sflb (`a`bbb`cc)
Space fill from right for list of strings
param x: | int |
---|---|
param y: | String |
returns: | String right padded with space |
q).str.sfrb (`a`bbb`cc)
zero fill
param x: | int |
---|---|
param y: | String |
returns: | String left padded with zero |
q).str.zfl (4;72)
zero fill from right
param x: | int |
---|---|
param y: | String |
returns: | String right padded with zero |
q).str.zfr (4;72)
handle the simple case otherwise flaten it to string
param x: | String |
---|---|
returns: | Converts the kdb objects to plain string |
q).str.strif[`test]
q).str.strif[2#`test]
q).str.strif[string `test]
q).str.strif[string 2#`test]