so i'm taking udacity's swift developers course. attempted @ forums question oddly, quiet. programming prompt:
var forwardstring = "stressed" var backwardsstring = forwardstring.characters.reversed() print(backwardsstring) var lottalikes = "if likeyou wanna learn swift likeyou should build lots of small apps cuz it's likea way practice." var nolikes = lottalikes.replacingoccurrences(of:"like", with:"") print(nolikes)
for whatever reason, keep getting error message:
be sure have replaced occurences of word "like" , removed spaces.
what missing here? if need clarification on happy provide it. thank you
it may code gets job done, because variable lottalikes
written in weird way. have 2 spaces surrounding word "like" removing word leave 2 spaces in row. suggest writing following line:
var nolikes = lottalikes.replacingoccurrences(of:"like ", with:"")
it may udacity not checking actual output, code itself. if so, may looking wrote above.
if still not work, may want write line so:
var noextraspaces = nolikes.replacingoccurences(of: " ", with: " ")
Comments
Post a Comment