Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string = "{part1}_{part2}_{part3}"
- result = string.format(part1="A", part2="", part3="B")
- actual_result = "A__B"
- desired_result = "A_B"
- result = string.format(part1="A__A", part2="", part3="B__B")
- result = result.replace("__", "_")
- actual_result = "A_A_B_B"
- desired_result = "A__A_B__B"
- ignore_str = "$IGNORE_STRING$"
- string = "{part1}_{part2}_{part3}"
- result = string.format(part1="A__A", part2=ignore_str, part3="B__B")
- result = result.replace("_" + ignore_str, "")
- actual_result = "A__A_B__B"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement