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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:51:02+00:00 2026-05-26T14:51:02+00:00

I have an int variable that basically looks something like this: 101137111 What I

  • 0

I have an int variable that basically looks something like this:

101137111

What I want to do, is replace an INT at a particular point. So for example, if I wanted to change the 7 with a 9. How would I achieve that? Bearing in mind that I don’t want to search for a 7, because there might be 7’s before.

So, another example:

var number = 101137111;
var newNumber;

newNumber = number.replaceAtPosition('4') andReplaceWith (9);

so now that should change the 3 to a 9

  • 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-26T14:51:03+00:00Added an answer on May 26, 2026 at 2:51 pm
    function replaceAtPosition(number,index,replacement){
        number += '';//to string
        number = number.substring(0,index) + replacement + number.substring(index+1);
        return +number; // to int
    }
    

    use it like :

    var number = 101137111;
    var newNumber = replaceAtPosition(number,4,9);
    

    See this live demo :

    http://jsfiddle.net/gion_13/m86yt/

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

Sidebar

Related Questions

I have declared a DLL import in my C# program that looks like this:
Basically, I have an int value, x, that is an instance variable of a
I have variable @count of datatype int.I am setting values to this @count. I
I have string value and Type of some variable (For example int and 32
Good afternoon all, I have a class which looks like this: public class Grapheme
I have this program that I want other processes to be able to call
Basically you have two ways for doing this: for (int x = 0; x
I have anonymous type variable which i am populating like that(i have two variables
Suppose that I have those three files: a.h //a.h header #include <stdio.h> int int_variable;
in SQL Server, if I have an int variable, how can I write a

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.