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

  • SEARCH
  • Home
  • 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 8019117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:17:18+00:00 2026-06-04T21:17:18+00:00

there is a string like this and it is stored in a file #{date}abcde.doc

  • 0

there is a string like this and it is stored in a file

#{date}abcde.doc

I want to be able to read this string and replace #{date} with

Date.today.strftime("%Y%m%d")

Is there any way to parse the template and do the evaluation? Thanks in advance!

  • 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-06-04T21:17:19+00:00Added an answer on June 4, 2026 at 9:17 pm

    Yes, however…

    It would be easier if you used hash replacement, like this:

    s = "%{date}abcde.doc"
    s % { date: Time.now.strftime(etc) }
    

    Or just use ERb.

    As-is you’re using string interpolation so it would need to be evaled, I think.

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

Sidebar

Related Questions

Lets say there is setup like this: public class MyClass { public void DoSomething(string
I am currently using a code construction like this: string line; using (System.IO.StreamReader file
I usually put my connection string to a separate file, adding something like this
Suppose I have a string like this: one two three four five six seven
I have three values in a string like this: $villes = '"paris","fes","rabat"'; When I
Is there any way to create a new NSString from a format string like
Is there a method that could tell for a string like foo bar Foo
is there a way to generate a boost uuid from a string like 988A00C4-79F3-46f9-98CD-D5AD4AA2A0FE
in a C++ program, there is a point when it reads a string like:
Is there some string class in Python like StringBuilder in C#?

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.