I know it's easy but it seems im doing it wrong. I have a itemname in a data file with _bp at the end of the name. I need my script to identify the _bp at the end and remove it from the name. I tried the Puts to show me the result but nothing appears. What's the best way? thank you
Code:if (itemName.Contains("_bp")) { itemName = itemName.Substring(0, itemName.Length - 3); Puts(itemName); }
Removing _bp from end of string?
Discussion in 'Rust Development' started by FireBurst, Apr 17, 2018.
-
Not much to go on with this, but if I were you, I'd be Puts'ing the itemName even before the if statement... Sounds like it isn't triggering at all if "nothing appears"
-
-
-
In RUST, use Puts, instead of ConsoleWriteLine.
If we are talking about reasons, why you do not see it in console
1) Your checks doesnot work (maybe because of case, so _BP instead of _bp in your data)
2) You have exception in Console that say where is trouble
If u will give more code, i will able to see where can be trouble. -
@FireBurst
Code:if (itemName.ToLower().EndsWith("_bp")) { itemName = itemName.Replace("_bp","").Replace("_BP",""); Puts(itemName); }