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 7800595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:41:18+00:00 2026-06-02T00:41:18+00:00

Why do I get a [Some] Object instead of a [String] Object? The Some

  • 0

Why do I get a [Some] Object instead of a [String] Object?
The Some object won’t work as a String Parameter in a method call.

The config def returns a String so I expect the type to be String.
But when I type “Hello” Scala get’s it correct.

Code

    def config(s: String) = Play.current.configuration.getString(s).toString()
    Logger.info(config("recaptcha.publicKey"))
    Logger.info("Hello")

Output

[info] application - Some(6LeDMdASAAAAAC4CFIDY-5M7NEZ_WnO0NO9CSdtj)
[info] application - Hello
  • 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-02T00:41:19+00:00Added an answer on June 2, 2026 at 12:41 am

    You are unnecessarily calling toString() on Option[String] (which Play.current.configuration.getString() returns), try this:

    def config(s: String) = Play.current.configuration.getString(s).get
    

    or maybe preferably:

    Play.current.configuration.getString(s).getOrElse("some default")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wanting to run AJAX to get some URL data, build an object from
Can I get the value of an object field some other way than obj.field
how can i get some part of string (in symbols). For example: $string =
I'm deserializing some properties to a Dictionary<string, object> . When I deserialize some json,
I have been testing out using delegates instead of reflection for some object sorting
Given the following method: public static void SetPropertyValue(object target, string propName, object value) {
I have a field in my table that holds a string denoting some object
I wanted to get some feedback on your thoughts of storing entire objects into
For some reason I get some warnings about non dll-interface class when building with
I would love to get some tips from other people that have had this

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.