Scala convert string to StringOps

Scala is visible to convert String objects to StringOps. How it's done? That is, how and when does Scala convert a String object to StringOps?

Cheers, Matthias

+5
source share
1 answer

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 will convert the String instance to the StringOps instance if you call the method from the StringOps class to String .

+6
source

Source: https://habr.com/ru/post/1235249/


All Articles