Hi @edhere, split the input string into the first character and the rest part, change the first character to uppercase, then concatenate them. The SubstringExtractor, the StringCaseChanger, and the StringConcatenator might help you.
Alternatively this string expression could also work as well.
@UpperCase(@Substring(@Value(_text),0,1))@Substring(@Value(_text),1)
Hi @edhere Or with a TclCaller:
return tstring toupper oFME_GetAttribute _text] 0 0]
Hi guys,
Thanks for the comments, I couldn't get above solutions to work so I used below. Seems to do the trick as well.
But a shorter version would be nice of course!
@takashi - Where would I put:
@UpperCase(@Substring(@Value(_text),0,1))@Substring(@Value(_text),1)
In an AttributeManager?
@DanAtSafe - I'm not familiar with the TclCaller, can you perhaps show me how the transformer should look with the code?
Hi @edhere Or with a TclCaller:
return tstring toupper oFME_GetAttribute _text] 0 0]
Scripting. I tried other languages, but probably the Tcl expression could be most concise.
JavaScript (JavaScriptCaller)
var t = fme_get_attribute('_text');
fme_set_attribute('_result', t.replace(/^./, t.charAt(0).toUpperCase()));
XQuery (XMLXQueryExtractor)
let $t := fme:get-attribute("_text")
return fn:replace($t, '^.', fn:upper-case(fn:substring($t,1,1)))
Hi guys,
Thanks for the comments, I couldn't get above solutions to work so I used below. Seems to do the trick as well.
But a shorter version would be nice of course!
@takashi - Where would I put:
@UpperCase(@Substring(@Value(_text),0,1))@Substring(@Value(_text),1)
In an AttributeManager?
@DanAtSafe - I'm not familiar with the TclCaller, can you perhaps show me how the transformer should look with the code?
Hi Ed, I think it should be like:
Hi guys,
Thanks for the comments, I couldn't get above solutions to work so I used below. Seems to do the trick as well.
But a shorter version would be nice of course!
@takashi - Where would I put:
@UpperCase(@Substring(@Value(_text),0,1))@Substring(@Value(_text),1)
In an AttributeManager?
@DanAtSafe - I'm not familiar with the TclCaller, can you perhaps show me how the transformer should look with the code?
The string expression is just an alternative. You can set the expression to the Attribute Value column in an AttributeManager or AttributeCreator.
However, if you got your desired result from those transformers, no need to use the expression.
Hi guys,
Thanks for the comments, I couldn't get above solutions to work so I used below. Seems to do the trick as well.
But a shorter version would be nice of course!
@takashi - Where would I put:
@UpperCase(@Substring(@Value(_text),0,1))@Substring(@Value(_text),1)
In an AttributeManager?
@DanAtSafe - I'm not familiar with the TclCaller, can you perhaps show me how the transformer should look with the code?
If you are interested in Tcl, try this.