Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala transform String to StringOps

Tags:

string

scala

Scala seems to transform objects of type String to StringOps. How is this done? I.e. how and when does Scala transform an object of String to StringOps?

like image 430
user1578293 Avatar asked Nov 04 '15 20:11

user1578293


1 Answers

There is an implicit conversion defined from String to StringOps in Predef.scala. https://github.com/scala/scala/blob/a24ca7fa617cabada82c43d2d6ac354db698d181/src/library/scala/Predef.scala#L308. This converts a String instance to a StringOps instance if you call method from StringOps class on a String.

like image 130
ntn Avatar answered Oct 05 '22 23:10

ntn