An extreme saying in software development is that "all hard-coded strings should be placed in resource files". I personally agree with this opinion, but sometimes it is limited to the project progress or other reasons, still habituallyCodeWrite some hard-coded strings, such as the following code:
Public void testmethod ()
{
String S = "this is a test string ";
}
If the Code contains a large number of hard-coded strings, you need to re-compile and generate each time the value of the string changes at the end of the project.ProgramThis is undoubtedly very unreasonable. Some may have said that you can solve the problem by placing the string directly in the resource file. Well, this is a good solution, but think about the hundreds of hard-coded strings in the code, it will undoubtedly give you a headache.
Let's take a look at rgreatex, the plug-in of resharper, which is a tool that can quickly refactor hard-coded strings in code to resource files. Let's just look at how to use it:
Select the string to be reconstructed, for example, "This is a string" in the previous example, and right-click and select "refactor-> localization-> move string to resource ".
If no special settings are available, click "Next". Then rgreatex will automatically search for the same strings in the Code. If yes, it will be reconstructed, if not, only the selected string is reconstructed. After reconstruction, our method will look like the following:
Public void testmethod ()
{
String S = resources. S;
}
How can we use rgreatex to reconstruct hard-coded strings? Does it save some time. If you think rgreatex is useful, download it from here.
PS: There are still a lot of software that can improve productivity. Please pay attention to it.