Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find hardcoded strings in kotlin

Android studio lint don't work for a kotlin project. I can't find hardcoded strings. What can be solution for this?

like image 463
Monotype Avatar asked Feb 13 '18 18:02

Monotype


People also ask

What is a hard-coded string?

The term hardcoded string refers to a string that doesn't depend on the input to the program but it also has connotations of being hard to change, meaning that you might have to edit the code in one or more places to change it.

Which can be used for extracting hard-coded strings from the code to resource files?

Lingobit Extractor is a new tool for software localization. The tool solves a huge part of internationalization task by extracting hard-coded strings from source code to resources.


1 Answers

Do these steps it worked for me

  • Download Android Studio 3.2 (in preview right now)
  • Open find in project window (cmd + shift + F for Mac)
  • Check Regex checkbox(Top right corner).
  • Check file mask(next to Regex) and type *.kt or choose kt from the drop down.
  • Type this regex = \"\w+\" you can see the results now.
  • Search with this regex =\"\w+\" in case code is not formatted properly.
like image 108
Abhishek Avatar answered Oct 08 '22 00:10

Abhishek