////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The String Operations transform can perform trim, case conversion, padding and other string operations on an incoming Hop field.

= image:transforms/icons/stringoperations.svg[String operations transform Icon, role="image-doc-icon"] String operations

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The String Operations transform can perform the following string operations on an incoming Hop field:

* Trim (remove leading and/or trailing spaces).
* Convert to upper or lowercase.
* Pad (add leading or trailing extra characters).
* Convert to initial capitalization.
* Ignore escape characters.
* Remove or return only numeric digits.
* Remove special characters..

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:question_mark.svg[Maybe Supported, 24]
!Flink! image:question_mark.svg[Maybe Supported, 24]
!Dataflow! image:question_mark.svg[Maybe Supported, 24]
!===
|===

== Options

[options="header"]
|===
|Option|Description
|Transform name|Name of the transform.
|In stream field|Designate the field to transform.
|Out stream field|Designate the name of the field to be created.
|Trim type|Designate the trim type: none, left, right, or both.
|Lower/Upper|Designate upper or lowercase.
|Padding|Designate left or right padding.
|Pad char|Designate the padding character.
|Pad Length|Designate how long the padding will be.
|InitCap|Transform to initial capitalization.
|Escape|Define to Escape or Unescape XML, HTML, use CDATA or Escape SQL.
|Digits|Designate whether to return remove, or do nothing to digits.
|Remove Special character|Designate a special character to remove.
|===

== Metadata Injection Support

All fields of this transform support metadata injection.
You can use this transform with ETL Metadata Injection to pass metadata to your pipeline at runtime.

Values for Metadata Injection

[options="header"]
|===
|Field|Values
|In stream fields|list of source fields
|Out stream fields|list of target fields
|Trim Type|0 = none +
1 = left +
2 = right +
3 = both
|Lower/Upper|0 = none +
1 = lower +
2 = upper
|Padding|0 = none +
1 = left +
2= right
|Pad Char| Character used for padding
|Pad Length| Lenght to pad
|InitCap|0 = no +
1 = yes
|Escape|0 = none +
1 = escapexml +
2 = cdata +
3 = unescapexml +
4 = escapesql +
5 = escapehtml +
6 = unescapehtml
|Digits|0 = none +
1 = digits_only +
2 = remove_digits
|Remove Special character|0 = none +
1 = cr +
2 = lf +
3 = crlf +
4 = tab +
5 = espace
|===