- Home /
Question by
villyviking · Nov 03, 2018 at 05:30 PM ·
textinputfieldstringsreplace
How can I change the phrase "I am sure you are right." to "You are sure I am right."?
How can I change the phrase "I am sure you are right." to "You are sure I am right."?
public class danskCoach : MonoBehaviour
{
public InputField mainInputField;
public void Update()
{
//when return is pressed i want to change the phrase "I am sure you are right." to "You are sure I am right."
if (Input.GetKeyDown(KeyCode.Return)) {
mainInputField.text = mainInputField.text.Replace("I am", "You").Replace("You", "I am");
}
}
}
Comment
I don't want to change words i've already changed. :)
Your answer
Follow this Question
Related Questions
How to take the text from a rich text input field and save each line into an array 1 Answer
Check current letter in typewriter textbox? 0 Answers
Problem splitting up strings 2 Answers
Changing just the name of person in UI Text 0 Answers
Clipboard pasting twice into InputField on Mac build 3 Answers