workato-platform-cli 1.0.0rc5.dev5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. workato_platform_cli/__init__.py +135 -0
  2. workato_platform_cli/_version.py +34 -0
  3. workato_platform_cli/cli/__init__.py +126 -0
  4. workato_platform_cli/cli/commands/__init__.py +0 -0
  5. workato_platform_cli/cli/commands/api_clients.py +627 -0
  6. workato_platform_cli/cli/commands/api_collections.py +497 -0
  7. workato_platform_cli/cli/commands/assets.py +82 -0
  8. workato_platform_cli/cli/commands/connections.py +1205 -0
  9. workato_platform_cli/cli/commands/connectors/__init__.py +0 -0
  10. workato_platform_cli/cli/commands/connectors/command.py +178 -0
  11. workato_platform_cli/cli/commands/connectors/connector_manager.py +351 -0
  12. workato_platform_cli/cli/commands/data_tables.py +345 -0
  13. workato_platform_cli/cli/commands/guide.py +315 -0
  14. workato_platform_cli/cli/commands/init.py +229 -0
  15. workato_platform_cli/cli/commands/profiles.py +364 -0
  16. workato_platform_cli/cli/commands/projects/__init__.py +0 -0
  17. workato_platform_cli/cli/commands/projects/command.py +513 -0
  18. workato_platform_cli/cli/commands/projects/project_manager.py +338 -0
  19. workato_platform_cli/cli/commands/properties.py +174 -0
  20. workato_platform_cli/cli/commands/pull.py +327 -0
  21. workato_platform_cli/cli/commands/push/__init__.py +0 -0
  22. workato_platform_cli/cli/commands/push/command.py +320 -0
  23. workato_platform_cli/cli/commands/recipes/__init__.py +0 -0
  24. workato_platform_cli/cli/commands/recipes/command.py +847 -0
  25. workato_platform_cli/cli/commands/recipes/validator.py +1740 -0
  26. workato_platform_cli/cli/commands/workspace.py +73 -0
  27. workato_platform_cli/cli/containers.py +80 -0
  28. workato_platform_cli/cli/resources/data/connection-data.json +7364 -0
  29. workato_platform_cli/cli/resources/data/picklist-data.json +3706 -0
  30. workato_platform_cli/cli/resources/docs/README.md +178 -0
  31. workato_platform_cli/cli/resources/docs/actions.md +452 -0
  32. workato_platform_cli/cli/resources/docs/block-structure.md +424 -0
  33. workato_platform_cli/cli/resources/docs/connections-parameters.md +11946 -0
  34. workato_platform_cli/cli/resources/docs/data-mapping.md +779 -0
  35. workato_platform_cli/cli/resources/docs/formulas/array-list-formulas.md +1276 -0
  36. workato_platform_cli/cli/resources/docs/formulas/conditions.md +102 -0
  37. workato_platform_cli/cli/resources/docs/formulas/date-formulas.md +798 -0
  38. workato_platform_cli/cli/resources/docs/formulas/number-formulas.md +507 -0
  39. workato_platform_cli/cli/resources/docs/formulas/other-formulas.md +419 -0
  40. workato_platform_cli/cli/resources/docs/formulas/string-formulas.md +1353 -0
  41. workato_platform_cli/cli/resources/docs/formulas.md +214 -0
  42. workato_platform_cli/cli/resources/docs/naming-conventions.md +163 -0
  43. workato_platform_cli/cli/resources/docs/recipe-deployment-workflow.md +352 -0
  44. workato_platform_cli/cli/resources/docs/recipe-fundamentals.md +179 -0
  45. workato_platform_cli/cli/resources/docs/triggers.md +360 -0
  46. workato_platform_cli/cli/utils/__init__.py +10 -0
  47. workato_platform_cli/cli/utils/config/__init__.py +33 -0
  48. workato_platform_cli/cli/utils/config/manager.py +1001 -0
  49. workato_platform_cli/cli/utils/config/models.py +89 -0
  50. workato_platform_cli/cli/utils/config/profiles.py +491 -0
  51. workato_platform_cli/cli/utils/config/workspace.py +113 -0
  52. workato_platform_cli/cli/utils/exception_handler.py +531 -0
  53. workato_platform_cli/cli/utils/gitignore.py +32 -0
  54. workato_platform_cli/cli/utils/ignore_patterns.py +44 -0
  55. workato_platform_cli/cli/utils/spinner.py +63 -0
  56. workato_platform_cli/cli/utils/version_checker.py +237 -0
  57. workato_platform_cli/client/__init__.py +0 -0
  58. workato_platform_cli/client/workato_api/__init__.py +202 -0
  59. workato_platform_cli/client/workato_api/api/__init__.py +15 -0
  60. workato_platform_cli/client/workato_api/api/api_platform_api.py +2875 -0
  61. workato_platform_cli/client/workato_api/api/connections_api.py +1807 -0
  62. workato_platform_cli/client/workato_api/api/connectors_api.py +840 -0
  63. workato_platform_cli/client/workato_api/api/data_tables_api.py +604 -0
  64. workato_platform_cli/client/workato_api/api/export_api.py +621 -0
  65. workato_platform_cli/client/workato_api/api/folders_api.py +621 -0
  66. workato_platform_cli/client/workato_api/api/packages_api.py +1197 -0
  67. workato_platform_cli/client/workato_api/api/projects_api.py +590 -0
  68. workato_platform_cli/client/workato_api/api/properties_api.py +620 -0
  69. workato_platform_cli/client/workato_api/api/recipes_api.py +1379 -0
  70. workato_platform_cli/client/workato_api/api/users_api.py +285 -0
  71. workato_platform_cli/client/workato_api/api_client.py +807 -0
  72. workato_platform_cli/client/workato_api/api_response.py +21 -0
  73. workato_platform_cli/client/workato_api/configuration.py +601 -0
  74. workato_platform_cli/client/workato_api/docs/APIPlatformApi.md +844 -0
  75. workato_platform_cli/client/workato_api/docs/ApiClient.md +46 -0
  76. workato_platform_cli/client/workato_api/docs/ApiClientApiCollectionsInner.md +30 -0
  77. workato_platform_cli/client/workato_api/docs/ApiClientApiPoliciesInner.md +30 -0
  78. workato_platform_cli/client/workato_api/docs/ApiClientCreateRequest.md +46 -0
  79. workato_platform_cli/client/workato_api/docs/ApiClientListResponse.md +32 -0
  80. workato_platform_cli/client/workato_api/docs/ApiClientResponse.md +29 -0
  81. workato_platform_cli/client/workato_api/docs/ApiCollection.md +38 -0
  82. workato_platform_cli/client/workato_api/docs/ApiCollectionCreateRequest.md +32 -0
  83. workato_platform_cli/client/workato_api/docs/ApiEndpoint.md +41 -0
  84. workato_platform_cli/client/workato_api/docs/ApiKey.md +36 -0
  85. workato_platform_cli/client/workato_api/docs/ApiKeyCreateRequest.md +32 -0
  86. workato_platform_cli/client/workato_api/docs/ApiKeyListResponse.md +32 -0
  87. workato_platform_cli/client/workato_api/docs/ApiKeyResponse.md +29 -0
  88. workato_platform_cli/client/workato_api/docs/Asset.md +39 -0
  89. workato_platform_cli/client/workato_api/docs/AssetReference.md +37 -0
  90. workato_platform_cli/client/workato_api/docs/Connection.md +44 -0
  91. workato_platform_cli/client/workato_api/docs/ConnectionCreateRequest.md +35 -0
  92. workato_platform_cli/client/workato_api/docs/ConnectionUpdateRequest.md +34 -0
  93. workato_platform_cli/client/workato_api/docs/ConnectionsApi.md +526 -0
  94. workato_platform_cli/client/workato_api/docs/ConnectorAction.md +33 -0
  95. workato_platform_cli/client/workato_api/docs/ConnectorVersion.md +32 -0
  96. workato_platform_cli/client/workato_api/docs/ConnectorsApi.md +249 -0
  97. workato_platform_cli/client/workato_api/docs/CreateExportManifestRequest.md +29 -0
  98. workato_platform_cli/client/workato_api/docs/CreateFolderRequest.md +30 -0
  99. workato_platform_cli/client/workato_api/docs/CustomConnector.md +35 -0
  100. workato_platform_cli/client/workato_api/docs/CustomConnectorCodeResponse.md +29 -0
  101. workato_platform_cli/client/workato_api/docs/CustomConnectorCodeResponseData.md +29 -0
  102. workato_platform_cli/client/workato_api/docs/CustomConnectorListResponse.md +29 -0
  103. workato_platform_cli/client/workato_api/docs/DataTable.md +34 -0
  104. workato_platform_cli/client/workato_api/docs/DataTableColumn.md +37 -0
  105. workato_platform_cli/client/workato_api/docs/DataTableColumnRequest.md +37 -0
  106. workato_platform_cli/client/workato_api/docs/DataTableCreateRequest.md +31 -0
  107. workato_platform_cli/client/workato_api/docs/DataTableCreateResponse.md +29 -0
  108. workato_platform_cli/client/workato_api/docs/DataTableListResponse.md +29 -0
  109. workato_platform_cli/client/workato_api/docs/DataTableRelation.md +30 -0
  110. workato_platform_cli/client/workato_api/docs/DataTablesApi.md +172 -0
  111. workato_platform_cli/client/workato_api/docs/DeleteProject403Response.md +29 -0
  112. workato_platform_cli/client/workato_api/docs/Error.md +29 -0
  113. workato_platform_cli/client/workato_api/docs/ExportApi.md +175 -0
  114. workato_platform_cli/client/workato_api/docs/ExportManifestRequest.md +35 -0
  115. workato_platform_cli/client/workato_api/docs/ExportManifestResponse.md +29 -0
  116. workato_platform_cli/client/workato_api/docs/ExportManifestResponseResult.md +36 -0
  117. workato_platform_cli/client/workato_api/docs/Folder.md +35 -0
  118. workato_platform_cli/client/workato_api/docs/FolderAssetsResponse.md +29 -0
  119. workato_platform_cli/client/workato_api/docs/FolderAssetsResponseResult.md +29 -0
  120. workato_platform_cli/client/workato_api/docs/FolderCreationResponse.md +35 -0
  121. workato_platform_cli/client/workato_api/docs/FoldersApi.md +176 -0
  122. workato_platform_cli/client/workato_api/docs/ImportResults.md +32 -0
  123. workato_platform_cli/client/workato_api/docs/OAuthUrlResponse.md +29 -0
  124. workato_platform_cli/client/workato_api/docs/OAuthUrlResponseData.md +29 -0
  125. workato_platform_cli/client/workato_api/docs/OpenApiSpec.md +30 -0
  126. workato_platform_cli/client/workato_api/docs/PackageDetailsResponse.md +35 -0
  127. workato_platform_cli/client/workato_api/docs/PackageDetailsResponseRecipeStatusInner.md +30 -0
  128. workato_platform_cli/client/workato_api/docs/PackageResponse.md +33 -0
  129. workato_platform_cli/client/workato_api/docs/PackagesApi.md +364 -0
  130. workato_platform_cli/client/workato_api/docs/PicklistRequest.md +30 -0
  131. workato_platform_cli/client/workato_api/docs/PicklistResponse.md +29 -0
  132. workato_platform_cli/client/workato_api/docs/PlatformConnector.md +36 -0
  133. workato_platform_cli/client/workato_api/docs/PlatformConnectorListResponse.md +32 -0
  134. workato_platform_cli/client/workato_api/docs/Project.md +32 -0
  135. workato_platform_cli/client/workato_api/docs/ProjectsApi.md +173 -0
  136. workato_platform_cli/client/workato_api/docs/PropertiesApi.md +186 -0
  137. workato_platform_cli/client/workato_api/docs/Recipe.md +58 -0
  138. workato_platform_cli/client/workato_api/docs/RecipeConfigInner.md +33 -0
  139. workato_platform_cli/client/workato_api/docs/RecipeConnectionUpdateRequest.md +30 -0
  140. workato_platform_cli/client/workato_api/docs/RecipeListResponse.md +29 -0
  141. workato_platform_cli/client/workato_api/docs/RecipeStartResponse.md +31 -0
  142. workato_platform_cli/client/workato_api/docs/RecipesApi.md +367 -0
  143. workato_platform_cli/client/workato_api/docs/RuntimeUserConnectionCreateRequest.md +34 -0
  144. workato_platform_cli/client/workato_api/docs/RuntimeUserConnectionResponse.md +29 -0
  145. workato_platform_cli/client/workato_api/docs/RuntimeUserConnectionResponseData.md +30 -0
  146. workato_platform_cli/client/workato_api/docs/SuccessResponse.md +29 -0
  147. workato_platform_cli/client/workato_api/docs/UpsertProjectPropertiesRequest.md +29 -0
  148. workato_platform_cli/client/workato_api/docs/User.md +48 -0
  149. workato_platform_cli/client/workato_api/docs/UsersApi.md +84 -0
  150. workato_platform_cli/client/workato_api/docs/ValidationError.md +30 -0
  151. workato_platform_cli/client/workato_api/docs/ValidationErrorErrorsValue.md +28 -0
  152. workato_platform_cli/client/workato_api/exceptions.py +216 -0
  153. workato_platform_cli/client/workato_api/models/__init__.py +83 -0
  154. workato_platform_cli/client/workato_api/models/api_client.py +185 -0
  155. workato_platform_cli/client/workato_api/models/api_client_api_collections_inner.py +89 -0
  156. workato_platform_cli/client/workato_api/models/api_client_api_policies_inner.py +89 -0
  157. workato_platform_cli/client/workato_api/models/api_client_create_request.py +138 -0
  158. workato_platform_cli/client/workato_api/models/api_client_list_response.py +101 -0
  159. workato_platform_cli/client/workato_api/models/api_client_response.py +91 -0
  160. workato_platform_cli/client/workato_api/models/api_collection.py +110 -0
  161. workato_platform_cli/client/workato_api/models/api_collection_create_request.py +97 -0
  162. workato_platform_cli/client/workato_api/models/api_endpoint.py +117 -0
  163. workato_platform_cli/client/workato_api/models/api_key.py +102 -0
  164. workato_platform_cli/client/workato_api/models/api_key_create_request.py +93 -0
  165. workato_platform_cli/client/workato_api/models/api_key_list_response.py +101 -0
  166. workato_platform_cli/client/workato_api/models/api_key_response.py +91 -0
  167. workato_platform_cli/client/workato_api/models/asset.py +124 -0
  168. workato_platform_cli/client/workato_api/models/asset_reference.py +110 -0
  169. workato_platform_cli/client/workato_api/models/connection.py +173 -0
  170. workato_platform_cli/client/workato_api/models/connection_create_request.py +99 -0
  171. workato_platform_cli/client/workato_api/models/connection_update_request.py +97 -0
  172. workato_platform_cli/client/workato_api/models/connector_action.py +100 -0
  173. workato_platform_cli/client/workato_api/models/connector_version.py +99 -0
  174. workato_platform_cli/client/workato_api/models/create_export_manifest_request.py +91 -0
  175. workato_platform_cli/client/workato_api/models/create_folder_request.py +89 -0
  176. workato_platform_cli/client/workato_api/models/custom_connector.py +117 -0
  177. workato_platform_cli/client/workato_api/models/custom_connector_code_response.py +91 -0
  178. workato_platform_cli/client/workato_api/models/custom_connector_code_response_data.py +87 -0
  179. workato_platform_cli/client/workato_api/models/custom_connector_list_response.py +95 -0
  180. workato_platform_cli/client/workato_api/models/data_table.py +107 -0
  181. workato_platform_cli/client/workato_api/models/data_table_column.py +125 -0
  182. workato_platform_cli/client/workato_api/models/data_table_column_request.py +130 -0
  183. workato_platform_cli/client/workato_api/models/data_table_create_request.py +99 -0
  184. workato_platform_cli/client/workato_api/models/data_table_create_response.py +91 -0
  185. workato_platform_cli/client/workato_api/models/data_table_list_response.py +95 -0
  186. workato_platform_cli/client/workato_api/models/data_table_relation.py +90 -0
  187. workato_platform_cli/client/workato_api/models/delete_project403_response.py +87 -0
  188. workato_platform_cli/client/workato_api/models/error.py +87 -0
  189. workato_platform_cli/client/workato_api/models/export_manifest_request.py +107 -0
  190. workato_platform_cli/client/workato_api/models/export_manifest_response.py +91 -0
  191. workato_platform_cli/client/workato_api/models/export_manifest_response_result.py +112 -0
  192. workato_platform_cli/client/workato_api/models/folder.py +110 -0
  193. workato_platform_cli/client/workato_api/models/folder_assets_response.py +91 -0
  194. workato_platform_cli/client/workato_api/models/folder_assets_response_result.py +95 -0
  195. workato_platform_cli/client/workato_api/models/folder_creation_response.py +110 -0
  196. workato_platform_cli/client/workato_api/models/import_results.py +93 -0
  197. workato_platform_cli/client/workato_api/models/o_auth_url_response.py +91 -0
  198. workato_platform_cli/client/workato_api/models/o_auth_url_response_data.py +87 -0
  199. workato_platform_cli/client/workato_api/models/open_api_spec.py +96 -0
  200. workato_platform_cli/client/workato_api/models/package_details_response.py +126 -0
  201. workato_platform_cli/client/workato_api/models/package_details_response_recipe_status_inner.py +99 -0
  202. workato_platform_cli/client/workato_api/models/package_response.py +109 -0
  203. workato_platform_cli/client/workato_api/models/picklist_request.py +89 -0
  204. workato_platform_cli/client/workato_api/models/picklist_response.py +88 -0
  205. workato_platform_cli/client/workato_api/models/platform_connector.py +116 -0
  206. workato_platform_cli/client/workato_api/models/platform_connector_list_response.py +101 -0
  207. workato_platform_cli/client/workato_api/models/project.py +93 -0
  208. workato_platform_cli/client/workato_api/models/recipe.py +174 -0
  209. workato_platform_cli/client/workato_api/models/recipe_config_inner.py +100 -0
  210. workato_platform_cli/client/workato_api/models/recipe_connection_update_request.py +89 -0
  211. workato_platform_cli/client/workato_api/models/recipe_list_response.py +95 -0
  212. workato_platform_cli/client/workato_api/models/recipe_start_response.py +91 -0
  213. workato_platform_cli/client/workato_api/models/runtime_user_connection_create_request.py +97 -0
  214. workato_platform_cli/client/workato_api/models/runtime_user_connection_response.py +91 -0
  215. workato_platform_cli/client/workato_api/models/runtime_user_connection_response_data.py +89 -0
  216. workato_platform_cli/client/workato_api/models/success_response.py +87 -0
  217. workato_platform_cli/client/workato_api/models/upsert_project_properties_request.py +88 -0
  218. workato_platform_cli/client/workato_api/models/user.py +151 -0
  219. workato_platform_cli/client/workato_api/models/validation_error.py +102 -0
  220. workato_platform_cli/client/workato_api/models/validation_error_errors_value.py +143 -0
  221. workato_platform_cli/client/workato_api/rest.py +213 -0
  222. workato_platform_cli/client/workato_api/test/__init__.py +0 -0
  223. workato_platform_cli/client/workato_api/test/test_api_client.py +94 -0
  224. workato_platform_cli/client/workato_api/test/test_api_client_api_collections_inner.py +52 -0
  225. workato_platform_cli/client/workato_api/test/test_api_client_api_policies_inner.py +52 -0
  226. workato_platform_cli/client/workato_api/test/test_api_client_create_request.py +75 -0
  227. workato_platform_cli/client/workato_api/test/test_api_client_list_response.py +114 -0
  228. workato_platform_cli/client/workato_api/test/test_api_client_response.py +104 -0
  229. workato_platform_cli/client/workato_api/test/test_api_collection.py +72 -0
  230. workato_platform_cli/client/workato_api/test/test_api_collection_create_request.py +57 -0
  231. workato_platform_cli/client/workato_api/test/test_api_endpoint.py +75 -0
  232. workato_platform_cli/client/workato_api/test/test_api_key.py +64 -0
  233. workato_platform_cli/client/workato_api/test/test_api_key_create_request.py +56 -0
  234. workato_platform_cli/client/workato_api/test/test_api_key_list_response.py +78 -0
  235. workato_platform_cli/client/workato_api/test/test_api_key_response.py +68 -0
  236. workato_platform_cli/client/workato_api/test/test_api_platform_api.py +101 -0
  237. workato_platform_cli/client/workato_api/test/test_asset.py +67 -0
  238. workato_platform_cli/client/workato_api/test/test_asset_reference.py +62 -0
  239. workato_platform_cli/client/workato_api/test/test_connection.py +81 -0
  240. workato_platform_cli/client/workato_api/test/test_connection_create_request.py +59 -0
  241. workato_platform_cli/client/workato_api/test/test_connection_update_request.py +56 -0
  242. workato_platform_cli/client/workato_api/test/test_connections_api.py +73 -0
  243. workato_platform_cli/client/workato_api/test/test_connector_action.py +59 -0
  244. workato_platform_cli/client/workato_api/test/test_connector_version.py +58 -0
  245. workato_platform_cli/client/workato_api/test/test_connectors_api.py +52 -0
  246. workato_platform_cli/client/workato_api/test/test_create_export_manifest_request.py +88 -0
  247. workato_platform_cli/client/workato_api/test/test_create_folder_request.py +53 -0
  248. workato_platform_cli/client/workato_api/test/test_custom_connector.py +76 -0
  249. workato_platform_cli/client/workato_api/test/test_custom_connector_code_response.py +54 -0
  250. workato_platform_cli/client/workato_api/test/test_custom_connector_code_response_data.py +52 -0
  251. workato_platform_cli/client/workato_api/test/test_custom_connector_list_response.py +82 -0
  252. workato_platform_cli/client/workato_api/test/test_data_table.py +88 -0
  253. workato_platform_cli/client/workato_api/test/test_data_table_column.py +72 -0
  254. workato_platform_cli/client/workato_api/test/test_data_table_column_request.py +64 -0
  255. workato_platform_cli/client/workato_api/test/test_data_table_create_request.py +82 -0
  256. workato_platform_cli/client/workato_api/test/test_data_table_create_response.py +90 -0
  257. workato_platform_cli/client/workato_api/test/test_data_table_list_response.py +94 -0
  258. workato_platform_cli/client/workato_api/test/test_data_table_relation.py +54 -0
  259. workato_platform_cli/client/workato_api/test/test_data_tables_api.py +45 -0
  260. workato_platform_cli/client/workato_api/test/test_delete_project403_response.py +51 -0
  261. workato_platform_cli/client/workato_api/test/test_error.py +52 -0
  262. workato_platform_cli/client/workato_api/test/test_export_api.py +45 -0
  263. workato_platform_cli/client/workato_api/test/test_export_manifest_request.py +69 -0
  264. workato_platform_cli/client/workato_api/test/test_export_manifest_response.py +68 -0
  265. workato_platform_cli/client/workato_api/test/test_export_manifest_response_result.py +66 -0
  266. workato_platform_cli/client/workato_api/test/test_folder.py +64 -0
  267. workato_platform_cli/client/workato_api/test/test_folder_assets_response.py +80 -0
  268. workato_platform_cli/client/workato_api/test/test_folder_assets_response_result.py +78 -0
  269. workato_platform_cli/client/workato_api/test/test_folder_creation_response.py +64 -0
  270. workato_platform_cli/client/workato_api/test/test_folders_api.py +45 -0
  271. workato_platform_cli/client/workato_api/test/test_import_results.py +58 -0
  272. workato_platform_cli/client/workato_api/test/test_o_auth_url_response.py +54 -0
  273. workato_platform_cli/client/workato_api/test/test_o_auth_url_response_data.py +52 -0
  274. workato_platform_cli/client/workato_api/test/test_open_api_spec.py +54 -0
  275. workato_platform_cli/client/workato_api/test/test_package_details_response.py +64 -0
  276. workato_platform_cli/client/workato_api/test/test_package_details_response_recipe_status_inner.py +52 -0
  277. workato_platform_cli/client/workato_api/test/test_package_response.py +58 -0
  278. workato_platform_cli/client/workato_api/test/test_packages_api.py +59 -0
  279. workato_platform_cli/client/workato_api/test/test_picklist_request.py +53 -0
  280. workato_platform_cli/client/workato_api/test/test_picklist_response.py +52 -0
  281. workato_platform_cli/client/workato_api/test/test_platform_connector.py +94 -0
  282. workato_platform_cli/client/workato_api/test/test_platform_connector_list_response.py +106 -0
  283. workato_platform_cli/client/workato_api/test/test_project.py +57 -0
  284. workato_platform_cli/client/workato_api/test/test_projects_api.py +45 -0
  285. workato_platform_cli/client/workato_api/test/test_properties_api.py +45 -0
  286. workato_platform_cli/client/workato_api/test/test_recipe.py +124 -0
  287. workato_platform_cli/client/workato_api/test/test_recipe_config_inner.py +55 -0
  288. workato_platform_cli/client/workato_api/test/test_recipe_connection_update_request.py +54 -0
  289. workato_platform_cli/client/workato_api/test/test_recipe_list_response.py +134 -0
  290. workato_platform_cli/client/workato_api/test/test_recipe_start_response.py +54 -0
  291. workato_platform_cli/client/workato_api/test/test_recipes_api.py +59 -0
  292. workato_platform_cli/client/workato_api/test/test_runtime_user_connection_create_request.py +59 -0
  293. workato_platform_cli/client/workato_api/test/test_runtime_user_connection_response.py +56 -0
  294. workato_platform_cli/client/workato_api/test/test_runtime_user_connection_response_data.py +54 -0
  295. workato_platform_cli/client/workato_api/test/test_success_response.py +52 -0
  296. workato_platform_cli/client/workato_api/test/test_upsert_project_properties_request.py +52 -0
  297. workato_platform_cli/client/workato_api/test/test_user.py +85 -0
  298. workato_platform_cli/client/workato_api/test/test_users_api.py +38 -0
  299. workato_platform_cli/client/workato_api/test/test_validation_error.py +52 -0
  300. workato_platform_cli/client/workato_api/test/test_validation_error_errors_value.py +50 -0
  301. workato_platform_cli/client/workato_api_README.md +205 -0
  302. workato_platform_cli-1.0.0rc5.dev5.dist-info/METADATA +185 -0
  303. workato_platform_cli-1.0.0rc5.dev5.dist-info/RECORD +306 -0
  304. workato_platform_cli-1.0.0rc5.dev5.dist-info/WHEEL +4 -0
  305. workato_platform_cli-1.0.0rc5.dev5.dist-info/entry_points.txt +2 -0
  306. workato_platform_cli-1.0.0rc5.dev5.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,1353 @@
1
+ ---
2
+ title: String formulas
3
+ date: 2017-03-30 05:00:00 Z
4
+ page_nav_depth: 3
5
+ ---
6
+
7
+ # String formulas
8
+ In Ruby, strings refer to sequences of text and characters. Workato supports a variety of string formulas.
9
+
10
+ Formulas in Workato are allowlisted Ruby methods. Syntax and functionality for these formulas are generally unchanged. Most formulas return an error and stop the job if the formula operates on nulls (expressed as `nil` in Ruby), except for `present?`, `presence`, and `blank?`.
11
+
12
+ You can refer to the Ruby documentation on [strings](https://ruby-doc.org/core-2.3.3/String.html) for more information. However, only allowlisted Ruby methods are supported. To request the addition of new formulas to the allowlist, [submit a support ticket](https://support.workato.com/en/support/tickets/new).
13
+
14
+ The following examples show methods that can be used to manipulate a string in Workato.
15
+
16
+ ---
17
+
18
+ ## Conditionals
19
+
20
+ This section will cover formulas which allow you to apply conditions (if-else) to your strings. Find out more about how to use conditionals [here](/formulas/conditions.md).
21
+
22
+ ---
23
+
24
+ ### `blank?`
25
+
26
+ This formula checks the input string and returns true if it is an empty string or if it is null.
27
+
28
+ #### Syntax
29
+
30
+ <kbd>Input</kbd>.blank?
31
+
32
+ - <kbd>Input</kbd> - An input datapill. It can be a string, number, date, or datetime datatype.
33
+
34
+ #### Sample usage
35
+
36
+ | Formula | Result |
37
+ | ----------------------------- | ------- |
38
+ | <kbd>"Any Value"</kbd>.blank? | false |
39
+ | <kbd>123</kbd>.blank? | false |
40
+ | <kbd>0</kbd>.blank? | false |
41
+ | <kbd>""</kbd>.blank? | true |
42
+
43
+ #### How it works
44
+
45
+ If the input is null or an empty string, the formula will return true. For any other data, it returns false.
46
+
47
+ #### See also
48
+
49
+ - [presence](/formulas/string-formulas.md#presence): Returns the data if it exists, returns nil if it does not.
50
+ - [present?](/formulas/string-formulas.md#present): Returns true if there is a valid input.
51
+
52
+ ---
53
+
54
+ ### `is_not_true?`
55
+
56
+ Evaluates a boolean value and returns true if the evaluated value is not true.
57
+
58
+ #### Syntax
59
+
60
+ <kbd>Input</kbd>.is_not_true?
61
+
62
+ - <kbd>Input</kbd> - An input boolean, an integer (`1` or `0`), or an accepted string value.
63
+
64
+ #### Sample usage
65
+
66
+ | Formula | Result |
67
+ | --------------------------------- | ------ |
68
+ | <kbd>true</kbd>.is_not_true? | false |
69
+ | <kbd>false</kbd>.is_not_true? | true |
70
+ | <kbd>0</kbd>.is_not_true? | true |
71
+ | <kbd>nil</kbd>.is_not_true? | true |
72
+
73
+ #### How it works
74
+
75
+ Takes in an input and evaluates if it is true or false.
76
+
77
+ ::: tip String values
78
+ `"true"`, `"t"`, `"yes"`,`"y"`, and `"1"` are evaluated as a boolean **true**.
79
+
80
+ `"false"`, `"f"`, `"no"`,`"n"`, and `"0"` are evaluated as a boolean **false**.
81
+
82
+ However, an empty string (`""`) is not evaluated as a boolean. This formula will display an error if used on a string datatype.
83
+ :::
84
+
85
+ #### See also
86
+
87
+ - [is_true](/formulas/string-formulas.md#is-true): Evaluates a boolean value and returns true if the evaluated value is true.
88
+
89
+ ---
90
+
91
+ ### `is_true?`
92
+
93
+ Evaluates a boolean value and returns true if the evaluated value is true.
94
+
95
+ #### Syntax
96
+
97
+ <kbd>Input</kbd>.is_true?
98
+
99
+ - <kbd>Input</kbd> - An input boolean, an integer (`1` or `0`), or an accepted string value.
100
+
101
+ #### Sample usage
102
+
103
+ | Formula | Result |
104
+ | ----------------------------- | ------ |
105
+ | <kbd>true</kbd>.is_true? | true |
106
+ | <kbd>false</kbd>.is_true? | false |
107
+ | <kbd>0</kbd>.is_true? | false |
108
+ | <kbd>nil</kbd>.is_true? | false |
109
+
110
+ #### How it works
111
+
112
+ Takes in an input and evaluates if it is true or false.
113
+
114
+ ::: tip String values
115
+ `"true"`, `"t"`, `"yes"`,`"y"`, and `"1"` are evaluated as a boolean **true**.
116
+
117
+ `"false"`, `"f"`, `"no"`,`"n"`, and `"0"` are evaluated as a boolean **false**.
118
+
119
+ However, an empty string (`""`) is not evaluated as a boolean. This formula will display an error if used on a string datatype.
120
+ :::
121
+
122
+ #### See also
123
+
124
+ - [is_not_true](/formulas/string-formulas.md#is-not-true): Evaluates a boolean value and returns true if the evaluated value is not true.
125
+
126
+ ---
127
+
128
+ ### `present?`
129
+
130
+ This formula will check the input and if there is a value present, it will return true. If the input is nil, boolean false, an empty string, or an empty list, the formula will return false.
131
+
132
+ #### Syntax
133
+
134
+ <kbd>Input</kbd>.present?
135
+
136
+ - <kbd>Input</kbd> - An input datapill. It can be a string, number, date, or list datatype.
137
+
138
+ #### Sample usage
139
+
140
+ | Formula | Result |
141
+ | ------------------------------------------------------ | ------- |
142
+ | <kbd>"Any Value"</kbd>.present? | true |
143
+ | <kbd>123</kbd>.present? | true |
144
+ | <kbd>0</kbd>.present? | true |
145
+ | <kbd>"2017-04-02T12:30:00.000000-07:00"</kbd>.present? | true |
146
+ | <kbd>nil</kbd>.present? | false |
147
+ | <kbd>""</kbd>.present? | false |
148
+ | <kbd>[]</kbd>.present? | false |
149
+
150
+ #### How it works
151
+
152
+ If the input is null, an empty string or an empty list, the formula will return false. For any other data, it returns true.
153
+
154
+ ::: tip Evaluating a list with nil values
155
+ - Only an empty list will return false.
156
+
157
+ <kbd>[]</kbd>.present? returns false.
158
+
159
+ - A list with nil and empty string will return true.
160
+
161
+ <kbd>[nil,""]</kbd>.present? returns true.
162
+ :::
163
+
164
+ #### See also
165
+
166
+ - [presence](/formulas/string-formulas.md#presence): Returns the data if it exists, returns nil if it does not.
167
+ - [blank?](/formulas/string-formulas.md#blank): Returns nil if the data does not exist or if the string consist of only white spaces.
168
+
169
+ ---
170
+
171
+ ### `presence`
172
+
173
+ Returns the data if it exists, returns nil if it does not.
174
+
175
+ #### Syntax
176
+
177
+ <kbd>Input</kbd>.presence
178
+
179
+ - <kbd>Input</kbd> - An input datapill. It can be a string, number, date, or datetime datatype.
180
+
181
+ #### Sample usage
182
+
183
+ | Formula | Result |
184
+ | ------------------------------- | ----------- |
185
+ | <kbd>nil</kbd>.presence | nil |
186
+ | <kbd>""</kbd>.presence | nil |
187
+ | <kbd>"Any Value"</kbd>.presence | "Any Value" |
188
+ | <kbd>45.0</kbd>.presence | 45.0 |
189
+ | <kbd>0</kbd>.presence | 0 |
190
+
191
+ #### How it works
192
+
193
+ If the input is null or an empty string, the formula will return nil. For any other data, it returns the original input data.
194
+
195
+ #### See also
196
+
197
+ - [blank?](/formulas/string-formulas.md#blank): Returns nil if the data does not exist or if the string consist of only white spaces.
198
+ - [present?](/formulas/string-formulas.md#present): Returns true if there is a valid input.
199
+
200
+ ---
201
+
202
+ ### `include?`
203
+
204
+ Checks if the string contains a specific substring. Returns true if it does.
205
+
206
+ #### Syntax
207
+
208
+ <kbd>Input</kbd>.include?(<span style="color:#FF0000">substring</span>)
209
+
210
+ - <kbd>Input</kbd> - A string input.
211
+ - <span style="color:#FF0000">substring</span> - The substring to check for.
212
+
213
+ #### Sample usage
214
+
215
+ | Formula | Result |
216
+ | ------------------------------------------------- | ------ |
217
+ | <kbd>"Partner account"</kbd>.include?("Partner") | true |
218
+ | <kbd>"Partner account"</kbd>.include?("partner") | false |
219
+
220
+ #### How it works
221
+
222
+ This formula checks if the string contains a specific substring. The formula returns true if the string includes the substring and false if does not. The substring is case sensitive.
223
+
224
+ This formula acts in the opposite manner from [exclude?](/formulas/string-formulas.md#exclude). The formula returns true only if the input string contains the stated keyword.
225
+
226
+ #### See also
227
+
228
+ - [exclude?](/formulas/string-formulas.md#exclude): Checks if the string contains a specific substring. Returns false if it does.
229
+
230
+ ---
231
+
232
+ ### `exclude?`
233
+
234
+ Checks if the string contains a specific substring. Returns false if it does.
235
+
236
+ #### Syntax
237
+
238
+ <kbd>Input</kbd>.exclude?(<span style="color:#FF0000">substring</span>)
239
+
240
+ - <kbd>Input</kbd> - A string input.
241
+ - <span style="color:#FF0000">substring</span> - The substring to check for.
242
+
243
+ #### Sample usage
244
+
245
+ | Formula | Result |
246
+ | ------------------------------------------------- | ------ |
247
+ | <kbd>"Partner account"</kbd>.exclude?("Partner") | false |
248
+ | <kbd>"Partner account"</kbd>.exclude?("partner") | true |
249
+
250
+ #### How it works
251
+
252
+ This formula check is the string contains a specific substring. Returns false if it does, otherwise, returns true. This substring is case sensitive.
253
+
254
+ This function acts in an opposite manner from [include?](/formulas/string-formulas.md#include). It will return true only if the input string does NOT contain the stated keyword.
255
+
256
+ #### See also
257
+
258
+ - [include?](/formulas/string-formulas.md#include): Checks if the string contains a specific substring. Returns true if it does.
259
+
260
+ ---
261
+
262
+ ### `match?`
263
+
264
+ Checks if the string contains a specific regular expression (regex) pattern. Returns true if it does.
265
+
266
+ #### Syntax
267
+
268
+ <kbd>Input</kbd>.match?(<span style="color:#FF0000">pattern</span>)
269
+
270
+ - <kbd>Input</kbd> - A string input.
271
+ - <span style="color:#FF0000">pattern</span> - The regex pattern to check for.
272
+
273
+ #### Sample usage
274
+
275
+ | Formula | Result |
276
+ | ------------------------------------------------- | ------ |
277
+ | <kbd>"Jean Marie"</kbd>.match?(/Marie/) | true |
278
+ | <kbd>"Jean Marie"</kbd>.match?(/ /) | true |
279
+ | <kbd>"Partner account"</kbd>.match?(/partner/) | false |
280
+
281
+ #### How it works
282
+
283
+ This formula checks if the string contains a specific regex pattern. Returns true if it does, otherwise, returns false.
284
+
285
+ #### See also
286
+
287
+ - [include?](/formulas/string-formulas.md#include): Checks if the string contains a specific substring. Returns true if it does.
288
+ - [exclude?](/formulas/string-formulas.md#exclude): Checks if the string contains a specific substring. Returns false if it does.
289
+
290
+ ---
291
+
292
+ ### `ends_with?`
293
+
294
+ Checks if the string ends with a specific substring. Returns true if it does.
295
+
296
+ #### Syntax
297
+
298
+ <kbd>Input</kbd>.ends_with?(<span style="color:#FF0000">substring</span>)
299
+
300
+ - <kbd>Input</kbd> - A string input.
301
+ - <span style="color:#FF0000">substring</span> - The substring to check for.
302
+
303
+ #### Sample usage
304
+
305
+ | Formula | Result |
306
+ | ------------------------------------------------- | ------ |
307
+ | <kbd>"Jean Marie"</kbd>.ends_with?("rie") | true |
308
+ | <kbd>"Jean Marie"</kbd>.ends_with?("RIE") | false |
309
+ | <kbd>"Jean Marie"</kbd>.upcase.ends_with?("RIE") | true |
310
+
311
+ #### How it works
312
+
313
+ This formula check is the string ends with a specific substring. Returns true if it does, otherwise, returns false.
314
+
315
+ #### See also
316
+
317
+ - [include?](/formulas/string-formulas.md#include): Checks if the string contains a specific substring. Returns true if it does.
318
+ - [exclude?](/formulas/string-formulas.md#exclude): Checks if the string contains a specific substring. Returns false if it does.
319
+ - [match?](/formulas/string-formulas.md#match): Checks if the string contains a specific pattern. Returns true if it does.
320
+ - [starts_with?](/formulas/string-formulas.md#starts-with): Checks if the string starts with a specific substring. Returns true if it does.
321
+
322
+ ---
323
+
324
+ ### `starts_with?`
325
+
326
+ Checks if the string starts with a specific substring. Returns true if it does.
327
+
328
+ #### Syntax
329
+
330
+ <kbd>Input</kbd>.starts_with?(<span style="color:#FF0000">substring</span>)
331
+
332
+ - <kbd>Input</kbd> - A string input.
333
+ - <span style="color:#FF0000">substring</span> - The substring to check for.
334
+
335
+ #### Sample usage
336
+
337
+ | Formula | Result |
338
+ | ---------------------------------------------------- | ------ |
339
+ | <kbd>"Jean Marie"</kbd>.starts_with?("Jean") | true |
340
+ | <kbd>"Jean Marie"</kbd>.starts_with?("JEAN") | false |
341
+ | <kbd>"Jean Marie"</kbd>.upcase.starts_with?("JEAN") | true |
342
+
343
+ #### How it works
344
+
345
+ This formula check is the string starts with a specific substring. Returns true if it does, otherwise, returns false.
346
+
347
+ #### See also
348
+
349
+ - [include?](/formulas/string-formulas.md#include): Checks if the string contains a specific substring. Returns true if it does.
350
+ - [exclude?](/formulas/string-formulas.md#exclude): Checks if the string contains a specific substring. Returns false if it does.
351
+ - [match?](/formulas/string-formulas.md#match): Checks if the string contains a specific pattern. Returns true if it does.
352
+ - [ends_with?](/formulas/string-formulas.md#ends-with): Checks if the string ends with a specific substring. Returns true if it does.
353
+
354
+ ---
355
+
356
+ ## Text manipulation
357
+
358
+ This section contains formulas which allow you to manipulate text within strings.
359
+
360
+ ---
361
+
362
+ ### `parameterize`
363
+
364
+ Replaces special characters in a string with standard characters. Used when app does not accept non-standard characters.
365
+
366
+ #### Syntax
367
+
368
+ <kbd>Input</kbd>.parameterize
369
+
370
+ - <kbd>Input</kbd> - An input string.
371
+
372
+ #### Sample usage
373
+
374
+ | Formula | Result |
375
+ | ----------------------------- | ------- |
376
+ | <kbd>"öüâ"</kbd>.parameterize | "oua" |
377
+
378
+ #### How it works
379
+
380
+ This formula searches for all special characters in the string and replaces them with standard characters.
381
+
382
+ ------
383
+
384
+ ### `lstrip`
385
+
386
+ This formula removes the white space at the beginning of the input string.
387
+
388
+ #### Syntax
389
+
390
+ <kbd>String</kbd>.lstrip
391
+
392
+ - <kbd>String</kbd> - An input string.
393
+
394
+ #### Sample usage
395
+
396
+ | Formula | Result |
397
+ | ----------------------------------- | ----------- |
398
+ | <kbd>" Test "</kbd>.lstrip | "Test " |
399
+
400
+ #### How it works
401
+
402
+ This formula removes white spaces from the beginning of a string. If the string doesn't have any white spaces before, the input string will be returned as is.
403
+
404
+ ::: tip SELECTIVELY REMOVE WHITE SPACES
405
+ - To remove white spaces from the end of a string, use [rstrip](/formulas/string-formulas.md#rstrip).
406
+ - To remove white spaces from the middle of a string, use [gsub](/formulas/string-formulas.md#gsub).<br>
407
+ <kbd>"a b c d e"</kbd>.gsub(" " , "") returns `"abcde"`.
408
+ :::
409
+
410
+ #### See also
411
+
412
+ - [strip](/formulas/string-formulas.md#strip): Removes the white space at the beginning and the end of the input string.
413
+ - [rstrip](/formulas/string-formulas.md#rstrip): Removes the white space at the end of the input string.
414
+ - [gsub](/formulas/string-formulas.md#gsub): Replace parts of a text string. Returns a new string with the replaced characters.
415
+
416
+ ---
417
+
418
+ ### `rstrip`
419
+
420
+ This formula removes the white space at the end of the input string.
421
+
422
+ #### Syntax
423
+
424
+ <kbd>String</kbd>.rstrip
425
+
426
+ - <kbd>String</kbd> - An input string.
427
+
428
+ #### Sample usage
429
+
430
+ | Formula | Result |
431
+ | ----------------------------------- | ----------- |
432
+ | <kbd>" Test "</kbd>.rstrip | " Test" |
433
+
434
+ #### How it works
435
+
436
+ This formula removes white spaces from the end of a string. If the string doesn't have any white spaces at the end, the input string will be returned as is.
437
+
438
+ ::: tip SELECTIVELY REMOVE WHITE SPACES
439
+ - To remove only white spaces from the beginning of a string, use [lstrip](/formulas/string-formulas.md#lstrip).
440
+ - To remove white spaces from the middle of the string, use [gsub](/formulas/string-formulas.md#gsub).<br>
441
+ <kbd>"a b c d e"</kbd>.gsub(" " , "") returns `"abcde"`.
442
+ :::
443
+
444
+ #### See also
445
+
446
+ - [strip](/formulas/string-formulas.md#rstrip): Removes the white space at the beginning and the end of the input string.
447
+ - [lstrip](/formulas/string-formulas.md#lstrip): Removes the white space at the beginning of the input string.
448
+ - [gsub](/formulas/string-formulas.md#gsub): Replace parts of a text string. Returns a new string with the replaced characters.
449
+
450
+ ---
451
+
452
+ ### `scrub`
453
+
454
+ If the string is an invalid byte sequence, the formula replaces the invalid bytes with a replacement character. If the string is not invalid, the formula returns the original string.
455
+
456
+ #### Syntax
457
+
458
+ <kbd>String</kbd>.scrub(<span style="color:#FF0000">replacement string</span>)
459
+
460
+ - <kbd>String</kbd> - An input string.
461
+
462
+ #### Sample usage
463
+
464
+ | Formula | Result |
465
+ | ------------------------------------------ | ------------ |
466
+ | <kbd>"abc\u3042\x81"</kbd>.scrub("*") | "abc\u3042*" |
467
+
468
+ ---
469
+
470
+ ### `strip`
471
+
472
+ This formula removes the white space at the beginning and end of the input string.
473
+
474
+ #### Syntax
475
+
476
+ <kbd>String</kbd>.strip
477
+
478
+ - <kbd>String</kbd> - An input string.
479
+
480
+ #### Sample usage
481
+
482
+ | Formula | Result |
483
+ | ------------------------------------------------------------ | -------------------------------------- |
484
+ | <kbd>"Welcome to the future of automation! "</kbd>.strip | "Welcome to the future of automation!" |
485
+ | <kbd>" This is an example "</kbd>.strip | "This is an example" |
486
+
487
+ #### How it works
488
+
489
+ This formula removes white spaces from both sides of a string. If the string doesn't have any white spaces on either side, the input string will be returned as is.
490
+
491
+ ::: tip SELECTIVELY REMOVE WHITE SPACES
492
+ - To remove only white spaces from one side, use [lstrip](/formulas/string-formulas.md#lstrip) or [rstrip](/formulas/string-formulas.md#rstrip).
493
+ - To remove white spaces from the middle of the string, use [gsub](/formulas/string-formulas.md#gsub).<br>
494
+ <kbd>"a b c d e"</kbd>.gsub(" " , "") returns `"abcde"`.
495
+ :::
496
+
497
+ #### See also
498
+
499
+ - [lstrip](/formulas/string-formulas.md#lstrip): Removes the white space at the beginning of the input string.
500
+ - [rstrip](/formulas/string-formulas.md#rstrip): Removes the white space at the end of the input string.
501
+ - [gsub](/formulas/string-formulas.md#gsub): Replace parts of a text string. Returns a new string with the replaced characters.
502
+
503
+ ---
504
+
505
+ ### `strip_tags`
506
+
507
+ This formula removes HTML tags embedded in a string.
508
+
509
+ #### Syntax
510
+
511
+ <kbd>String</kbd>.strip_tags
512
+
513
+ - <kbd>String</kbd> - An input string.
514
+
515
+ #### Sample usage
516
+
517
+ | Formula | Result |
518
+ | ------------------------------------------ | ------------ |
519
+ | <kbd>"\<p>Jean Marie\</p>".</kbd>.strip_tags | "Jean Marie" |
520
+
521
+ #### How it works
522
+
523
+ This formula checks for HTML tags within the input string. It removes any HTML tags found and returns the string.
524
+
525
+ #### See also
526
+
527
+ - [strip](/formulas/string-formulas.md#rstrip): Removes the white space at the beginning and the end of the input string.
528
+
529
+ ---
530
+
531
+ ### `ljust`
532
+
533
+ Aligns the string to left and pads it with whitespace or the provided character/string until the string is a specified length.
534
+
535
+ #### Syntax
536
+
537
+ <kbd>String</kbd>.ljust(<span style="color:#FF0000">length</span>,<span style="color:#FF0000">character</span>)
538
+
539
+ - <kbd>String</kbd> - An input string.
540
+ - <span style="color:#FF0000">length</span> - The length of the output string.
541
+ - <span style="color:#FF0000">character</span> - (optional) The character or string used to pad the input string. If unspecified, the default pad character is a blank space.
542
+
543
+ #### Sample usage
544
+
545
+ | Formula | Result |
546
+ | --------------------------------- | ------------ |
547
+ | <kbd>"test"</kbd>.ljust(5) | "test " |
548
+ | <kbd>"test"</kbd>.ljust(10, "*") | "test******" |
549
+ | <kbd>"test"</kbd>.ljust(9, "12345") | "test12345" |
550
+
551
+ #### See also
552
+
553
+ - [rjust](/formulas/string-formulas.md#rjust): Aligns the string to right and pads with whitespace or the provided string until string is specified length.
554
+
555
+ ---
556
+
557
+ ### `rjust`
558
+
559
+ Aligns the string to left and pads it with whitespace or a provided character/string until string is a specified length.
560
+
561
+ #### Syntax
562
+
563
+ <kbd>String</kbd>.rjust(<span style="color:#FF0000">length</span>,<span style="color:#FF0000">character</span>)
564
+
565
+ - <kbd>String</kbd> - An input string.
566
+ - <span style="color:#FF0000">length</span> - The length of the output string.
567
+ - <span style="color:#FF0000">character</span> - (optional) The character or string padding the input string. If unspecified, the default pad character is a blank space.
568
+
569
+ #### Sample usage
570
+
571
+ | Formula | Result |
572
+ | --------------------------------- | ------------ |
573
+ | <kbd>"test"</kbd>.rjust(5) | " test" |
574
+ | <kbd>"test"</kbd>.rjust(10, "*") | "******test" |
575
+ | <kbd>"test"</kbd>.rjust(9, "12345") | "12345test" |
576
+
577
+ #### See also
578
+
579
+ - [ljust](/formulas/string-formulas.md#ljust): Aligns the string to left and pads it with whitespace or the provided string until string is a specified length.
580
+
581
+ ------
582
+
583
+ ### `reverse`
584
+
585
+ Inverts a string, reordering the characters in reverse order. Case is preserved.
586
+
587
+ #### Syntax
588
+
589
+ <kbd>String</kbd>.reverse
590
+
591
+ - <kbd>String</kbd> - An input string.
592
+
593
+ #### Sample usage
594
+
595
+ | Formula | Result |
596
+ | --------------------------------- | -------------- |
597
+ | <kbd>"Jean Marie"</kbd>.reverse | "eiraM naeJ" |
598
+ | <kbd>" jean marie "</kbd>.reverse | " eiram naej " |
599
+
600
+ ---
601
+
602
+ ### `gsub`
603
+
604
+ Replace parts of a text string. Returns a new string with the replaced characters.
605
+
606
+ #### Syntax
607
+
608
+ <kbd>String</kbd>.gsub(<span style="color:#FF0000">find</span>,<span style="color:#FF0000">replace</span>)
609
+
610
+ - <kbd>String</kbd> - An input string. You can use a datapill or a static string value.
611
+ - <span style="color:#FF0000">find</span> - The string or regular expression (regex) to look for. Use a `/pattern/` syntax for regex.
612
+ - <span style="color:#FF0000">replace</span> - The replacement string. You can define the replacement using a string or [hash](/formulas/array-list-formulas.md#hashes).
613
+
614
+ #### Sample usage
615
+
616
+ | Formula | Result |
617
+ | ------------------------------------------------------------------- | ---------------------------------- |
618
+ | <kbd>"I have a blue house and a blue car"</kbd>.gsub("blue", "red") | "I have a red house and a red car" |
619
+ | <kbd>"Jean Marie"</kbd>.gsub("J", "M") | "Mean Marie" |
620
+ | <kbd>"Jean Marie"</kbd>.gsub(/[Jr]/, 'M') | "Mean MaMie" |
621
+ | <kbd>"Jean Marie"</kbd>.downcase.gsub("j", "M") | "Mean marie" |
622
+
623
+ #### Advanced sample usage
624
+
625
+ Learn more about advanced usage for the `gsub` method from the [Ruby documentation](https://ruby-doc.org/core-2.7.2/String.html#method-i-gsub.)
626
+
627
+ | Formula | Result |
628
+ | ----------------------------------------------------- | --------- |
629
+ | <kbd>"Awesome"</kbd>.gsub(/[Ae]/, 'A'=>'E', 'e'=>'a') | "Ewasoma" |
630
+ | <kbd>"Anna's Cafe"</kbd>.gsub("'", "\\\\'") | "Annas Cafes Cafe"<br>This replaces the quotation symbol with text after the breakpoint. |
631
+ | <kbd>"Anna's Cafe"</kbd>.gsub("'", {"'"=>"\\\\'"}) | "Anna\\\\'s Cafe"<br>This replace the quotation symbol with a replacement string.|
632
+
633
+ #### How it works
634
+
635
+ This formula is similar to find and replace. It takes two input parameters:
636
+
637
+ - **First input**: The string that you plan to replace. The input is case-sensitive, so make sure to input uppercase or lowercase correctly to find all occurrences that are an exact match.
638
+ - **Second input**: The new string that replaces all occurrences of the first input.
639
+
640
+ #### See also
641
+
642
+ - [sub](/formulas/string-formulas.md#sub): Replaces the first occurrence of a search term.
643
+
644
+ ---
645
+
646
+ ### `sub`
647
+
648
+ Replaces the first occurrence of the first input value, with the second input value, within the string. This formula is case-sensitive - make sure to type in uppercase or lowercase before comparison if you are concerned about case sensitivity.
649
+
650
+ #### Syntax
651
+
652
+ <kbd>String</kbd>.sub(<span style="color:#FF0000">find</span>,<span style="color:#FF0000">replace</span>)
653
+
654
+ - <kbd>String</kbd> - An input string. You can use a datapill or a static string value.
655
+ - <span style="color:#FF0000">find</span> - The string or regular expression (regex) to look for. Use a `/pattern/` syntax for regex.
656
+ - <span style="color:#FF0000">replace</span> - The replacement string. You can define the replacement using a string or [hash](/formulas/array-list-formulas.md#hashes).
657
+
658
+ #### Sample usage
659
+ | Formula | Result |
660
+ | -------------------------------------------- | ------------ |
661
+ | <kbd>"Mean Marie"</kbd>.sub(/M/, "J") | "Jean Marie" |
662
+ | <kbd>"Hello"</kbd>.sub(/[aeiou]/, "*") | "H*llo" |
663
+
664
+ ---
665
+
666
+ ### `length`
667
+
668
+ Returns the number of characters within an input string, including whitespaces.
669
+
670
+ #### Syntax
671
+
672
+ <kbd>String</kbd>.length
673
+
674
+ - <kbd>String</kbd> - An input string.
675
+
676
+ #### Sample usage
677
+
678
+ | Formula | Result |
679
+ | -------------------------------- | ------ |
680
+ | <kbd>"Jean Marie"</kbd>.length | 10 |
681
+ | <kbd>" jean marie "</kbd>.length | 12 |
682
+
683
+ ---
684
+
685
+ ### `slice`
686
+
687
+ Returns a partial segment of a string.
688
+
689
+ #### Syntax
690
+
691
+ <kbd>String</kbd>.slice(<span style="color:#FF0000">start</span>,<span style="color:#FF0000">end</span>)
692
+
693
+ - <kbd>String</kbd> - An input string.
694
+ - <span style="color:#FF0000">start</span> - The index of the string to start returning a partial segment at. Strings are zero-indexed.
695
+ - <span style="color:#FF0000">end</span> - (optional) The number of characters to return. If unspecified, the formula will return only one character.
696
+
697
+ #### Sample usage
698
+
699
+ | Formula | Result |
700
+ | ----------------------------------- | ------- |
701
+ | <kbd>"Jean Marie"</kbd>.slice(0,3) | "Jea" |
702
+ | <kbd>"Jean Marie"</kbd>.slice(5) | "M" |
703
+ | <kbd>"Jean Marie"</kbd>.slice(3,3) | "n M" |
704
+ | <kbd>"Jean Marie"</kbd>.slice(-5,5) | "Marie" |
705
+
706
+ #### How it works
707
+
708
+ The formula returns a partial segment of a string. It takes in two parameters - the first parameter is the index that decides which part of the string to start returning from. The first letter of a string corresponds to an index of 0. Negative numbers start from the last character, so an index of -1 is the last character in the string. The second parameter decides how many characters to return. If you only pass in the first parameter, one character is returned.
709
+
710
+ ---
711
+
712
+ ### `scan`
713
+
714
+ Scan the string for the regex pattern to retrieve and returns an array.
715
+
716
+ #### Syntax
717
+
718
+ <kbd>String</kbd>.scan(<span style="color:#FF0000">pattern</span>)
719
+
720
+ - <kbd>String</kbd> - An input string.
721
+ - <span style="color:#FF0000">regex pattern</span> - The regex pattern to search for.
722
+
723
+ #### Sample usage
724
+
725
+ | Formula | Result |
726
+ | --------------------------------------------------- | ------------------ |
727
+ | <kbd>"Thu, 01/23/2014"</kbd>.scan(/\d+/) | ["01","23","2014"] |
728
+ | <kbd>"Thu, 01/23/2014"</kbd>.scan(/\d+/).join("-") | "01-23-2014" |
729
+
730
+ ---
731
+
732
+ ### `encode`
733
+
734
+ Returns the string encoded.
735
+
736
+ #### Syntax
737
+
738
+ <kbd>String</kbd>.encode(<span style="color:#FF0000">encoding</span>)
739
+
740
+ - <kbd>String</kbd> - An input string.
741
+ - <span style="color:#FF0000">encoding</span> - Name of the encoding (for example, Windows-1252). Learn more about ruby encodings [here](https://en.wikibooks.org/wiki/Ruby_Programming/Encoding).
742
+
743
+ #### Sample usage
744
+
745
+ | Formula | Result |
746
+ | ------------------------- | ------- |
747
+ | `"Jean Marie"`.encode("Windows-1252") | "Jean Marie" |
748
+ | `"Olé!"`.encode("UTF-8") | `"Olé!"` |
749
+ | `"Olé"`.encode("ASCII") | "Error calculating input: U+00E9 from UTF-8 to US-ASCII" |
750
+
751
+
752
+ ---
753
+
754
+ ### `transliterate`
755
+
756
+ Replaces non-ASCII characters with an ASCII approximation. If no approximation exists, it uses a replacement character which defaults to '?'.
757
+
758
+ #### Syntax
759
+
760
+ <kbd>String</kbd>.transliterate
761
+
762
+ - <kbd>String</kbd> - An input string.
763
+
764
+ #### Sample usage
765
+
766
+ | Formula | Result |
767
+ | ------------------------- | ------- |
768
+ | <kbd>"Chloé"</kbd>.transliterate | "Chloe" |
769
+
770
+ - [parameterize](/formulas/string-formulas.md#parameterize): Replaces special characters in a string.
771
+
772
+ ---
773
+
774
+ ## Text case manipulation
775
+
776
+ This section covers formulas which allow you to change the case of certain parts of a word.
777
+
778
+ ------
779
+
780
+ ### `capitalize`
781
+
782
+ Converts the input string into sentence case, where the first character of the string is capitalized and all other characters are lowercase.
783
+
784
+ #### Syntax
785
+
786
+ <kbd>String</kbd>.capitalize
787
+
788
+ - <kbd>String</kbd> - An input string.
789
+
790
+ #### Sample usage
791
+
792
+ | Formula | Result |
793
+ | -------------------------------------- | ------------------------- |
794
+ | <kbd>"ticket opened. Gold SLA"</kbd>.capitalize | "Ticket opened. gold sla" |
795
+ | <kbd>"jean MARIE"</kbd>.capitalize | "Jean marie" |
796
+
797
+ ------
798
+
799
+ ### `titleize`
800
+
801
+ Converts the input string into title case, where the first character of each word is capitalized and all other characters are lowercase.
802
+
803
+ #### Syntax
804
+
805
+ <kbd>String</kbd>.titleize
806
+
807
+ - <kbd>String</kbd> - An input string.
808
+
809
+ #### Sample usage
810
+
811
+ | Formula | Result |
812
+ | ------------------------------------ | ------------------------- |
813
+ | <kbd>"ticket opened. Gold SLA"</kbd>.titleize | "Ticket Opened. Gold Sla" |
814
+ | <kbd>"jean MARIE"</kbd>.titleize | "Jean Marie" |
815
+
816
+ ---
817
+
818
+ ### `upcase`
819
+
820
+ Convert text to uppercase.
821
+
822
+ #### Syntax
823
+
824
+ <kbd>String</kbd>.upcase
825
+
826
+ - <kbd>String</kbd> - An input string.
827
+
828
+ #### Sample usage
829
+
830
+ | Formula | Result |
831
+ | ---------------------------------------------- | ---------------------------- |
832
+ | <kbd>"Automation at its FINEST!"</kbd>.upcase | "AUTOMATION AT ITS FINEST!" |
833
+ | <kbd>"Convert to UPCASE"</kbd>.upcase | "CONVERT TO UPCASE" |
834
+
835
+ #### How it works
836
+
837
+ This formula searches for any lowercase character and replace it with the uppercase characters.
838
+
839
+ ::: tip USE UPCASE TO IMPROVE STRING SEARCHES
840
+ Search formulas like ([gsub](/formulas/string-formulas.md#gsub) or [sub](/formulas/string-formulas.md#sub)) use case sensitive characters. Use the `upcase` formula to ensure that all characters are in the same case before searching.
841
+ :::
842
+
843
+ #### See also
844
+
845
+ - [downcase](/formulas/string-formulas.md#downcase): Convert text to lowercase.
846
+ - [capitalize](/formulas/string-formulas.md#capitalize): Convert text to sentence case.
847
+ - [titleize](/formulas/string-formulas.md#titleize): Convert text to title case.
848
+
849
+ ---
850
+
851
+ ### `downcase`
852
+
853
+ Convert text to lowercase.
854
+ ::: details Video tutorial: Downcase formula use case
855
+ <Video src="https://www.youtube.com/embed/HXBe9PVwH0M"/>
856
+ :::
857
+
858
+ #### Syntax
859
+
860
+ <kbd>String</kbd>.downcase
861
+
862
+ - <kbd>String</kbd> - An input string.
863
+
864
+ #### Sample usage
865
+
866
+ | Formula | Result |
867
+ | ------------------------------------------------ | --------------------------- |
868
+ | <kbd>"Automation at its FINEST!"</kbd>.downcase | "automation at its finest!" |
869
+ | <kbd>"Convert to DOWNCASE"</kbd>.downcase | "convert to downcase" |
870
+
871
+ #### How it works
872
+
873
+ This formula searches for any uppercase character and replace it with the lowercase characters.
874
+
875
+ ::: tip USE DOWNCASE TO IMPROVE STRING SEARCHES
876
+ Search formulas like ([gsub](/formulas/string-formulas.md#gsub) or [sub](/formulas/string-formulas.md#sub)) use case sensitive characters. Use the `downcase` formula to ensure that all characters are in the same case before searching.
877
+ :::
878
+
879
+ #### See also
880
+
881
+ - [upcase](/formulas/string-formulas.md#upcase): Convert text to uppercase.
882
+ - [capitalize](/formulas/string-formulas.md#capitalize): Convert text to sentencecase.
883
+ - [titleize](/formulas/string-formulas.md#titleize): Convert text to titlecase.
884
+
885
+ ---
886
+
887
+ ### `quote`
888
+
889
+ Quotes a string, escaping any ' (single quote) characters
890
+
891
+ #### Syntax
892
+
893
+ <kbd>String</kbd>.quote
894
+
895
+ - <kbd>String</kbd> - An input string.
896
+
897
+ #### Sample usage
898
+
899
+ | Formula | Result |
900
+ | ------------------------------------ | ------------------------- |
901
+ | <kbd>"Paula's Baked Goods"</kbd>.quote | "Paula\'s Baked Goods" |
902
+
903
+ ---
904
+
905
+ ## Converting to arrays and back
906
+
907
+ This section shows how you can manipulate strings into arrays.
908
+
909
+ ---
910
+
911
+ ### `split`
912
+
913
+ This formula divides a string around a specified character and returns an array of strings.
914
+ ::: details Watch a step-by-step video tutorial instead
915
+ <Video src="https://www.youtube.com/embed/trpODHgNzCY"/>
916
+ :::
917
+
918
+ #### Syntax
919
+
920
+ <kbd>String</kbd>.split(<span style="color:#FF0000">char</span>)
921
+
922
+ - <kbd>String</kbd> - An input string value. You can use a datapill or a static value.
923
+ - <span style="color:#FF0000">char</span> - (optional) The character to split the text at. This is case sensitive. If no character is defined, then by default, strings are split by white spaces.
924
+
925
+ #### Sample usage
926
+
927
+ | Formula | Result |
928
+ | ------------------------------------- | ----------------------- |
929
+ | <kbd>"Ms-Jean-Marie"</kbd>.split("-") | ["Ms", "Jean", "Marie"] |
930
+ | <kbd>"Ms Jean Marie"</kbd>.split | ["Ms", "Jean", "Marie"] |
931
+ | <kbd>"Split string"</kbd>.split() | ["Split", "string"] |
932
+ | <kbd>"Split string"</kbd>.split("t") | ["Split", " s", "ring"] |
933
+ | <kbd>"01/23/2014"</kbd>.split("/") | ["01", "23", "2014"] |
934
+ | <kbd>"01/23/2014"</kbd>.split("/").join("-") | "01-23-2014" |
935
+
936
+ #### How it works
937
+
938
+ This formula looks for the specified character in the input string. Every time it is found, the input will be split into a new string.
939
+
940
+ ::: tip Split characters
941
+ You can use a string of characters together as the split argument (for example, `"and"`).
942
+
943
+ <kbd>"You and Me"</kbd>.split(`"and"`) returns `["You","Me"]`.
944
+ :::
945
+
946
+ #### See also
947
+
948
+ - [strip](/formulas/string-formulas.md#strip): Removes white space around the input string.
949
+ - [slice](/formulas/string-formulas.md#slice): Returns a partial segment of a string.
950
+ - [match](/formulas/string-formulas.md#match): Checks the input string for a particular pattern.
951
+ - [join](/formulas/array-list-formulas.md#join): Combines list items into a string.
952
+
953
+ ---
954
+
955
+ ### `bytes`
956
+
957
+ Returns an array of bytes for a given string.
958
+
959
+ #### Syntax
960
+
961
+ <kbd>String</kbd>.bytes
962
+
963
+ - <kbd>String</kbd> - An input string.
964
+
965
+ #### Sample usage
966
+
967
+ | Formula | Result |
968
+ | -------------------------- | ----------------- |
969
+ | <kbd>"Hello"</kbd>.bytes | ["72", "101", "108", "108", "111"] |
970
+
971
+ ---
972
+
973
+ ### `bytesize`
974
+
975
+ Returns the length of a given string in bytes.
976
+
977
+ #### Syntax
978
+
979
+ <kbd>Input</kbd>.bytesize
980
+
981
+ - <kbd>Input</kbd> - Any input string.
982
+
983
+ #### Sample usage
984
+
985
+ | Formula | Result |
986
+ | ---------------------------------------- | -------------------- |
987
+ | <kbd>"Hello"</kbd>.bytesize | 5 |
988
+
989
+ ---
990
+
991
+ ### `byteslice`
992
+
993
+ Returns a substring of specified bytes instead of length. In some cases, non ASCII characters such as Japanese or Chinese may use multiple bytes.
994
+
995
+ #### Syntax
996
+
997
+ <kbd>Input</kbd>.byteslice(0,4)
998
+
999
+ - <kbd>Input</kbd> - Any input string.
1000
+
1001
+ #### Sample usage
1002
+
1003
+ | Formula | Result |
1004
+ | ---------------------------------------- | -------------------- |
1005
+ | <kbd>"hello"</kbd>.byteslice(1) | e |
1006
+ | <kbd>"hello"</kbd>.byteslice(-1) | o |
1007
+ | <kbd>"hello"</kbd>.byteslice(1,2) | el |
1008
+ | <kbd>"abc漢字"</kbd>.byteslice(0,4) | abc漢 |
1009
+
1010
+ ---
1011
+
1012
+ ## Conversion of other data types to strings {: #conversions :}
1013
+
1014
+ ---
1015
+
1016
+ ### `to_s`
1017
+
1018
+ Converts non-string data types such as numbers or dates to a string (text) datatype.
1019
+
1020
+ ::: details Video tutorial: to_s formula use case
1021
+ <Video src="https://www.youtube.com/embed/nOkGS8fYv5g"/>
1022
+ :::
1023
+
1024
+ #### Syntax
1025
+
1026
+ <kbd>Input</kbd>.to_s
1027
+
1028
+ - <kbd>Input</kbd> - Any input data. You can use number, array, object, or datetime datatypes.
1029
+
1030
+ #### Sample usage
1031
+
1032
+ | Formula | Result |
1033
+ | ---------------------------------------------------------- | ---------------------------------- |
1034
+ | <kbd>-45.67</kbd>.to_s | "-45.67" |
1035
+ | <kbd>"123"</kbd>.to_s | "123" |
1036
+ | <kbd>[1, 2, 3]</kbd>.to_s | "[1, 2, 3]" |
1037
+ | <kbd>{key: "Workato"}</kbd>.to_s | "{:key=>"Workato"}" |
1038
+ | <kbd>"2020-06-05T17:13:27.000000-07:00"</kbd>.to_s | "2020-06-05T17:13:27.000000-07:00" |
1039
+ | <kbd>"2020-06-05T17:13:27.000000-07:00"</kbd>.to_s(:short) | "05 Jun 17:13" |
1040
+ | <kbd>"2020-06-05T17:13:27.000000-07:00"</kbd>.to_s(:long) | "June 05, 2020 17:13" |
1041
+
1042
+ #### How it works
1043
+
1044
+ This formula returns a string representation of the input data.
1045
+
1046
+ ::: tip OUTPUT IS A STRING DATATYPE
1047
+ A string representation of a list cannot be used in a [**repeat step**](/recipes/steps.md#repeat-step).
1048
+ :::
1049
+
1050
+ #### See also
1051
+
1052
+ - [to_f](/formulas/string-formulas.md#to-f): Converts data to a float (number) datatype.
1053
+ - [to_i](/formulas/string-formulas.md#to-i): Converts data to an integer (whole number) datatype.
1054
+
1055
+ ---
1056
+
1057
+ ### `ordinalize`
1058
+
1059
+ Turns a number into an ordinal string used to denote the position in an ordered sequence, such as 1st, 2nd, 3rd, 4th.
1060
+
1061
+ #### Syntax
1062
+
1063
+ <kbd>Input</kbd>.ordinalize
1064
+
1065
+ - <kbd>Input</kbd> - Any input number.
1066
+
1067
+ #### Sample usage
1068
+
1069
+ | Formula | Result |
1070
+ | -------------------------- | -------------------- |
1071
+ | <kbd>1</kbd>.ordinalize | "1st" |
1072
+ | <kbd>2</kbd>.ordinalize | "2nd" |
1073
+ | <kbd>3</kbd>.ordinalize | "3rd" |
1074
+ | <kbd>1003</kbd>.ordinalize | "1003rd" |
1075
+ | <kbd>-3</kbd>.ordinalize | "-3rd" |
1076
+
1077
+ ---
1078
+
1079
+ ## Conversion of strings to other data types
1080
+
1081
+ ---
1082
+
1083
+ ### `to_f`
1084
+
1085
+ Converts data to a float (number) datatype.
1086
+
1087
+ #### Syntax
1088
+
1089
+ <kbd>Input</kbd>.to_f
1090
+
1091
+ - <kbd>Input</kbd> - Numerical input data. You can use a string datatype or a integer datatype.
1092
+
1093
+ #### Sample usage
1094
+
1095
+ | Formula | Result |
1096
+ | ------------------------- | ------ |
1097
+ | <kbd>45</kbd>.to_f | 45.0 |
1098
+ | <kbd>-45</kbd>.to_f | -45.0 |
1099
+ | <kbd>"45.67"</kbd>.to_f | 45.67 |
1100
+ | <kbd>"Workato"</kbd>.to_f | 0 |
1101
+
1102
+ #### How it works
1103
+
1104
+ This formula checks if the input contains any numbers. If no numbers are found, it returns 0. If the number does not have a decimal point, `.0` is added to the number.
1105
+
1106
+ #### See also
1107
+
1108
+ - [to_i](/formulas/string-formulas.md#to-i): Convert data to an integer (whole number) datatype.
1109
+
1110
+ ---
1111
+
1112
+ ### `to_i`
1113
+
1114
+ Converts data to an integer (whole number) datatype.
1115
+
1116
+ #### Syntax
1117
+
1118
+ <kbd>Input</kbd>.to_i
1119
+
1120
+ - <kbd>Input</kbd> - Numerical input data. You can use a string datatype or a float datatype.
1121
+
1122
+ #### Sample usage
1123
+
1124
+ | Formula | Result |
1125
+ | ------------------------- | ------ |
1126
+ | <kbd>45.43</kbd>.to_i | 45 |
1127
+ | <kbd>-45.43</kbd>.to_i | -45 |
1128
+ | <kbd>"123"</kbd>.to_i | 123 |
1129
+ | <kbd>"Workato"</kbd>.to_i | 0 |
1130
+
1131
+ #### How it works
1132
+
1133
+ This formula checks if the input contains any numbers. If no numbers are found, it returns 0. If the number has a decimal point, everything after the decimal is omitted.
1134
+
1135
+ ::: tip CHECK FOR INTEGERS
1136
+ You can use this formula to check if a string contains an integer. If the input does not contain any numbers, the formula returns `0`.
1137
+ :::
1138
+
1139
+ #### See also
1140
+
1141
+ - [to_f](/formulas/string-formulas.md#to-f): Converts data to a float (number) datatype.
1142
+
1143
+ ---
1144
+
1145
+ ### `to_country_alpha2`
1146
+
1147
+ Convert an alpha-3 country code or country name to an alpha-2 country code (first 2 initials).
1148
+
1149
+ #### Syntax
1150
+
1151
+ <kbd>Input</kbd>.to_country_alpha2
1152
+
1153
+ - <kbd>Input</kbd> - Any input string.
1154
+
1155
+ #### Sample usage
1156
+
1157
+ | Formula | Result |
1158
+ | ---------------------------------- | ------ |
1159
+ | <kbd>"GBR"</kbd>.to_country_alpha2 | "GB" |
1160
+ | <kbd>"United Kingdom"</kbd>.to_country_alpha2 | "GB" |
1161
+
1162
+ ---
1163
+
1164
+ ### `to_country_alpha3`
1165
+
1166
+ Convert alpha-2 country code or country name to an alpha-3 country code (first 3 initials).
1167
+
1168
+ #### Syntax
1169
+
1170
+ <kbd>Input</kbd>.to_country_alpha3
1171
+
1172
+ - <kbd>Input</kbd> - Any input string.
1173
+
1174
+ #### Sample usage
1175
+
1176
+ | Formula | Result |
1177
+ | ---------------------------------- | ------ |
1178
+ | <kbd>"GB"</kbd>.to_country_alpha3 | "GBR" |
1179
+ | <kbd>"United Kingdom"</kbd>.to_country_alpha3 | "GBR" |
1180
+
1181
+ ---
1182
+
1183
+ ### to_country_name
1184
+
1185
+ Convert alpha-2, alpha-3 country code, or country name to ISO3166 country name.
1186
+
1187
+ #### Syntax
1188
+
1189
+ <kbd>Input</kbd>.to_country_name
1190
+
1191
+ - <kbd>Input</kbd> - Any input string.
1192
+
1193
+ #### Sample usage
1194
+
1195
+ | Formula | Result |
1196
+ | --------------------- | -------------- |
1197
+ | <kbd>"GBR"</kbd>.to_country_name | "United Kingdom" |
1198
+ | <kbd>"GB"</kbd>.to_country_name | "United Kingdom" |
1199
+
1200
+ ---
1201
+
1202
+ ### `to_currency`
1203
+
1204
+ Formats integers or numbers to a currency-style, adding a default currency symbol at the start of the string.
1205
+
1206
+ #### Syntax
1207
+
1208
+ <kbd>Input</kbd>.to_currency
1209
+
1210
+ - <kbd>Input</kbd> - Any input string.
1211
+
1212
+ #### Sample usage
1213
+
1214
+ | Formula | Description | Result |
1215
+ | ------------------------------- | -------------------------------- | --------- |
1216
+ | <kbd>"345.60"</kbd>.to_currency | Adds default currency symbol "$" | "$345.60" |
1217
+
1218
+ #### Advanced sample usage
1219
+
1220
+ Learn more about advanced use of the to_currency formula. A comma-separated combination of these may be used to achieve the desired currency format. For example:
1221
+
1222
+ ```ruby
1223
+ "12345.678".to_currency(delimiter: ".", format: "%n %u", precision: 2, separator: ",", unit: "€")
1224
+ ```
1225
+
1226
+ | Formula | Description | Result |
1227
+ | ------------------| ------------- | -------- |
1228
+ | <kbd>"345.60"</kbd>.to_currency(unit: "€") | Changes the default currency unit | "€345.60" |
1229
+ | <kbd>"345.60"</kbd>.to_currency(format: "%n %u") | Changes the position of the number relative to the unit (where the number is represented by `%n` and the currency unit is represented by `%u`). Accepts 0 or 1 spaces in between. Defaults to `"%u%n"`. | "345.60 $" |
1230
+ | <kbd>"-345.60"</kbd>.to_currency(negative_format: "(%u%n)") | Specifies the format when the number is negative (where the number is represented by `%n` and the currency unit is represented by `%u`). | "($345.60)" |
1231
+ | <kbd>"345.678"</kbd>.to_currency | Precision defaults to 2 decimal places | "$345.68" |
1232
+ | <kbd>"345.678"</kbd>.to_currency(precision: 3) | Change the precision by specifying the number of decimal places | "$345.678" |
1233
+ | <kbd>"345.678"</kbd>.to_currency(separator: ",") | Specify the **decimal separator** as ".", "," or " ". Defaults to ".". | "$345,68" |
1234
+ | <kbd>"12345.678"</kbd>.to_currency(delimiter: ".") | Specify the **thousands separator** as ",", "." or " ". Defaults to ",".| "$12.345.68"|
1235
+
1236
+ ---
1237
+
1238
+ ### `to_currency_code`
1239
+
1240
+ Convert alpha-2, alpha-3 country code, or country name to ISO4217 currency code
1241
+
1242
+ #### Syntax
1243
+
1244
+ <kbd>Input</kbd>.to_currency_code
1245
+
1246
+ - <kbd>Input</kbd> - Any input string.
1247
+
1248
+ #### Sample usage
1249
+
1250
+ | Formula | Result |
1251
+ | ---------------------- | ------ |
1252
+ | <kbd>"GBR"</kbd>.to_currency_code | "GBP" |
1253
+ | <kbd>"US"</kbd>.to_currency_code | "USD" |
1254
+
1255
+ ---
1256
+
1257
+ ### `to_currency_name`
1258
+
1259
+ Convert alpha-3 currency code or alpha-2/3 country code or country name to ISO4217 currency name.
1260
+
1261
+ #### Syntax
1262
+
1263
+ <kbd>Input</kbd>.to_currency_name
1264
+
1265
+ - <kbd>Input</kbd> - Any input string.
1266
+
1267
+ #### Sample usage
1268
+
1269
+ | Formula | Result |
1270
+ | ---------------------- | ------- |
1271
+ | <kbd>"GBR"</kbd>.to_currency_code | "Pound" |
1272
+ | <kbd>"USD"</kbd>.to_currency_code | "Dollars" |
1273
+
1274
+ ---
1275
+
1276
+ ### `to_currency_symbol`
1277
+
1278
+ Convert alpha-3 currency code or alpha-2/3 country code or country name to ISO4217 currency symbol.
1279
+
1280
+ #### Syntax
1281
+
1282
+ <kbd>Input</kbd>.to_currency_symbol
1283
+
1284
+ - <kbd>Input</kbd> - Any input string.
1285
+
1286
+ #### Sample usage
1287
+
1288
+ | Formula | Result |
1289
+ | ---------------------- | ------ |
1290
+ | <kbd>"GBR"</kbd>.to_currency_symbol | "£" |
1291
+ | <kbd>"USD"</kbd>.to_currency_symbol | "$" |
1292
+
1293
+ ---
1294
+
1295
+ ### `to_phone`
1296
+
1297
+ Converts string or number to a formatted phone number (user-defined).
1298
+
1299
+ #### Syntax
1300
+
1301
+ <kbd>Input</kbd>.to_phone
1302
+
1303
+ - <kbd>Input</kbd> - Any input string or number.
1304
+
1305
+ #### Sample usage
1306
+
1307
+ | Formula | Result |
1308
+ | ---------------------------------------- | -------------------- |
1309
+ | <kbd>"5551234"</kbd>.to_phone | 555-1234 |
1310
+ | <kbd>1235551234</kbd>.to_phone | 123-555-1234 |
1311
+ | <kbd>1235551234</kbd>.to_phone(area_code: true) | (123) 555-1234 |
1312
+ | <kbd>1235551234</kbd>.to_phone(delimiter: " ") | 123 555 1234 |
1313
+ | <kbd>1235551234</kbd>.to_phone(area_code: true, extension: 555) | (123) 555-1234 x 555 |
1314
+ | <kbd>1235551234</kbd>.to_phone(country_code: 1) | +1-123-555-1234 |
1315
+ | <kbd>"123a456</kbd>".to_phone | 123a456 |
1316
+
1317
+ ---
1318
+
1319
+ ### `to_state_code`
1320
+
1321
+ Convert state name to code.
1322
+
1323
+ #### Syntax
1324
+
1325
+ <kbd>Input</kbd>.to_state_code
1326
+
1327
+ - <kbd>Input</kbd> - Any input string.
1328
+
1329
+ #### Sample usage
1330
+
1331
+ | Formula | Result |
1332
+ | ---------------------------------------- | -------------------- |
1333
+ | <kbd>"California"</kbd>.to_state_code | CA |
1334
+
1335
+ ---
1336
+
1337
+ ### `to_state_name`
1338
+
1339
+ Convert state code to name.
1340
+
1341
+ #### Syntax
1342
+
1343
+ <kbd>Input</kbd>.to_state_name
1344
+
1345
+ - <kbd>Input</kbd> - Any input string.
1346
+
1347
+ #### Sample usage
1348
+
1349
+ | Formula | Result |
1350
+ | ---------------------------------------- | -------------------- |
1351
+ | <kbd>"CA"</kbd>.to_state_name | CALIFORNIA |
1352
+
1353
+ ---