Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7648747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:47:40+00:00 2026-05-31T10:47:40+00:00

(First time please be gentle etc. etc.) Let’s say I was lazy/unthinking/pressed for time

  • 0

(First time please be gentle etc. etc.)

Let’s say I was lazy/unthinking/pressed for time and hardcoded a string instead of making a global variable. And I repeated this mistake over hundreds of classes and test cases that I wrote. Now, I want to fix this, since I found out I’ll eventually need to update that string. Is there some refactoring method in Eclipse or elsewhere that will let me replace all instances of that specific string with a global variable?

I can think of a programmatic solution, to run through all those files and replace the string, but I’d prefer not to go down that route unless absolutely necessary.

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:47:42+00:00Added an answer on May 31, 2026 at 10:47 am

    Well you can use search and replace within Eclipse across all the files in your project, for one thing. You don’t need to write that yourself.

    It doesn’t look like the “Extract Constant” refactoring of Eclipse is willing to extract it across classes, unfortunately. That would obviously be the nicer solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time poster. Please be gentle. This topic may be similar to several other
This is my first time asking a question, please be gentle! I have a
First time posting, please let me know if this question has already been answered!
Occasional reader and first time question asker, so please be gentle :) I am
First time Stack Overflow poster. Please bear with me! :) I have a set
first time poster and TDD adopter. :-) I'll be a bit verbose so please
This is my first time playing with both ajax and objects, so please go
OK, so I'm working with a little regular expression—it's my first time, please, be
This is my first post, so please be gentle. I've been playing around with
First time poster, so please excuse any stupidity. I'm working on porting a custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.