The expression used Model runs and removes spaces but not apostrophes
I am trying to run a model on a dataset, and in doing so I create new features from the input spreadsheet. The NAME_SHIP field is being used to create the names of the new feature classes but the field is set up with illegal characters. I am already using one CALCULATE VALUE tool in my model but found that some of the ship names also include an " ' " (apostrophe) in them. Is there a way to either:
- Include an expression in the already existing CALCULATE VALUE to rid the names of the apostrophe? or
- Where do I insert another CALCULATE VALUE tool in the model to fix for both issues while creating a new FC?
1 Answer 1
This can be easily done in the same calculate tool so no need to add another tool.
If you think about it what does a replace function return? A string! Which you can put through another function!
Here is a silly example were ww
would be your %Value%
ww = "Wwww 23'rrr"
ww.replace(" ","").replace("'","_")
returns
'Wwww23_rrr'