做了一个自己看着还舒服的vue 日历表_时间表 vue-程序员宅基地

技术标签: 前端  vue.js  javascript  

直接上图

在这里插入图片描述

在这里我引入的是别的地方的插件

有拖动和点击事件的功能 方便存储

直接看代码吧就


<!--
 * @Descripttion: (工作日历管理/C_Calendar)
 * @version: (1.0)
 * @Author: (admin)
 * @Date: (2022-12-20)
 * @LastEditors: (admin)
 * @LastEditTime: (2022-12-20)
-->		    
<template>
  <div class="app-container" style="padding: 0px">
    <el-form :model="form" @submit.native.prevent ref="form">
      <el-row :gutter="15">
        <el-col :lg="3">
          <el-form-item label="班次编号" prop="flightNo">
            <el-select placeholder="请选择安排的班次" multiple v-model="form.flightNo" style="width: 70%">
              <el-option v-for="item in glFlightList" :key="item.id" :value="item.flightCode">
                <span :style="{ color: item.flightColor }">{
   { item.flightName }}</span></el-option
              >
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="3">
          <el-form-item label="线体编号" prop="lineCode">
            <el-select placeholder="请选择线体" multiple v-model="form.lineCode" style="width: 70%">
              <el-option v-for="item in LineList" :key="item.id" :value="item.lineCode">
                <span> {
   { item.lineCode + '  /  ' + item.lineName }}</span></el-option
              >
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="2">
          <el-button type="primary" @click="handleAdd">添加出勤</el-button>
        </el-col>
        <el-col :lg="1">  <el-button type="danger"  @click="deletes">删除出勤</el-button>
         </el-col>
        <el-col :lg="13">
          <p>&nbsp;</p>
        </el-col>
        <!-- <el-col :lg="2">
          <el-button  type="success" @click="seeFlight" >查看现有排班</el-button>
        </el-col> -->
      </el-row>
    </el-form>

    <div class="calendar">
      <div class="select">
        <el-form inline >
          <el-form-item>
            <el-select v-model="curYear" placeholder="请选择">
              <el-option v-for="item in yearOptions" :key="item.key" :value="item.value" :label="item.label" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-select v-model="curMonth" placeholder="请选择">
              <el-option v-for="item in monthOptions" :key="item.key" :value="item.value" :label="item.label" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="handleQuickChange('prev')">上一月</el-button>
            <el-button type="primary" @click="handleQuickChange('next')">下一月</el-button>
            <el-button style="background-color: #dcdfe6" @click="TwoChange">滑动</el-button>
          </el-form-item>
        </el-form>
      </div>

      <table class="calendar-table" :style="{ width }">
        <thead>
          <tr>
            <th v-for="(item, i) in weeks" :key="i">{
   { item }}</th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(dates, i) in res" :key="i" :style="{ height: tbodyHeight }" align="center" style="font-size: medium" border>
            <td
              v-for="(item, index) in dates"
              :key="index"
              :class="{
                notCurMonth: !item.isCurMonth,
                // currentDay: item.date === curDate,
                selectDay: item.isSelected,
                rangeSelectd: item.isRangeSelected,
                weekend: item.isWeekend,
                seeNow: item.isSele,
              }"
              @click="handleItemClick(item, i, index)"
              @mouseover="handleItemMove(item, i, index)"
            >
              <!-- @click="handleItemClick(item, i, index)" -->
              <!-- <span>{
    { item.date.split('-').slice(1).join('-') }}</span> -->
              <span>{
   { item.date }}</span>
              <slot :data="item" />
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <!-- <el-form :model="queryParams" size="small"  inline ref="queryForm" 
      @submit.native.prevent>
           
      <el-form-item label="班次名称" prop="flightNo">
        <el-select  v-model="queryParams.flightNo" placeholder="请选择线体" >
        <el-option v-for="item in glFlightList" :key="item.id" :label="item.flightName" :value="item.flightCode"></el-option>      
       </el-select> 
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form> -->
    <div style="margin-top: -33px">
    <el-collapse v-model="subTableCollapse" @change="handleChange"> 
      <el-collapse-item name="1">
            <template slot="title">
              <span class="subTableTitle"><strong>排班详情信息</strong></span>
            </template>
    <el-table :data="detailList" ref="table" border highlight-current-row title="已安排的班次" height="200px"   :row-class-name="tableRowClassName">
      <el-table-column width="250%" prop="flightNo" label="班次编号" align="center" :show-overflow-tooltip="true">

        <!-- <template slot-scope="scope">
                  {
    { lineNameFormat(scope.row['flightNo'] )}}
                </template> -->
      </el-table-column>
      <el-table-column width="250%" prop="lineCode" label="线体编号" align="center" :show-overflow-tooltip="true" />
      <el-table-column width="500%" prop="attendanceDate" label="出勤日期" align="center" :show-overflow-tooltip="true"> </el-table-column>

      <el-table-column width="250%" prop="createBy" label="创建人" align="center" :show-overflow-tooltip="true" />
      <el-table-column width="300%" prop="createTime" label="创建时间" align="center" :show-overflow-tooltip="true" />
      <el-table-column  label="操作" align="center" width="200">
            <template slot-scope="scope">
                   
                      <el-button size="mini" v-hasPermi="['schedule:ccalendar:delete']" type="danger" icon="el-icon-delete" title="删除" 
                @click="handleDelete(scope.row)"></el-button>
                </template>
          </el-table-column>
    </el-table>
    </el-collapse-item>
    </el-collapse>
    </div>
  </div>
</template>
<script>
import {
       listBLineInfo } from '@/api/factorys/bLineInfo.js'

import {
      
 getAttendanceData,
  addCCalendar,
  delCCalendar,
  getDaysInMonth,
  handleCrateDate,
  handleCreateDatePicker,
  parseTime,
  listCCalendar,
  DeleteFlightNo,
  getDetail,
} from '@/api/schedule/cCalendar.js'
import {
       GetBFlightAll } from '@/api/factorys/bFlightInfo.js'
export default {
      
  components: {
      },
  props: {
      
    selectMode: {
      
      type: String,
      default: 'click',
    },
    startOfWeek: {
      
      type: Number,
      default: 1,
    },
    canSelect: {
      
      type: Boolean,
      default: false,
    },
    width: {
      
      type: String,
      default: '90%',
    },
    tbodyHeight: {
      
      type: String,
      default: '60px',
    },
  },

  name: 'ccalendar',
  data() {
      
    return {
      
      change: undefined,
      //线体数据
      LineList: [],
      subTableCollapse : 1,
     
      // 表单参数
      form: {
      },
      //线体参数查询
      LineQueryParams: {
      
        pageNum: 1,
        pageSize: 1000,
        sort: undefined,
        sortType: undefined,
      },
      // 查询参数
      queryParams: {
      
        pageNum: 1,
        pageSize: 10000,
        sort: undefined,
        sortType: undefined,
        flightNo: undefined,
        lineCode: undefined,
      },
      flightList: [], //班次列表
      monthOptions: [],
      yearOptions: [],
      weeks: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
      curYear: new Date().getFullYear(), // 当前年
      curMonth: new Date().getMonth(), // 当前月
      days: 0, // 当前月总共天数
      curDate: parseTime(new Date().getTime()), // 当前日期 yyyy-MM-dd 格式,用来匹配是否是当前日期
      prevDays: [], // 非当前月的上一月展示的日期
      rearDays: [], // 非当前月的下一月展示的日期
      curDays: [], // 当前月的日期
      showDays: [], // 总共展示的42个日期
      res: [], // 二维数组
      arr: [],
      selectedDates: [], // 选中的日期
      selectedMode: false, // true表示点击, false表示滑动
      moveIndex: [], // 两个,第一个是起始,第二个是结束
      canMove: false, // 当moveIndex数组有一个值时,可以触发滑动
      a: '000003',
      downList: [],
      arrDown: [],
      detailList : [],
      glFlightList: [],
      arrFlightCode: [],
    }
  },
  computed: {
      },
  watch: {
      
    curMonth: {
      
      handler(val) {
      
        this.handleGetDays(this.curYear, val, this.startOfWeek)
      },
    },
    curYear: {
      
      handler(val) {
      
        this.handleGetDays(val, this.curMonth, this.startOfWeek)
      },
    },
  },

  created() {
      
    // 列表数据查询
    this.getDownList()
    this.getLineList()
    this.getFlightList()
    this.getFlightData()
   
    this.weeks.unshift(...this.weeks.splice(this.startOfWeek - 1))
    this.handleGetDays(this.curYear, this.curMonth, this.startOfWeek)
    this.selectedMode = this.selectMode === 'click'
    //this.selectedMode = this.selectMode === this.change
  },
  mounted() {
      
    this.monthOptions = handleCreateDatePicker().months
    this.yearOptions = handleCreateDatePicker().years
    if (localStorage.selectedDates) this.selectedDates = JSON.parse(localStorage.selectedDates)
  },
 
  methods: {
      
    handleChange(value) {
      
      if (value.length > 0) {
      
        this.props.width = 300
      } else {
      
        this.props.width = 550
      }
    },
      /** 删除按钮操作 */
      handleDelete(row) {
      
      const Ids = row.id || this.ids;
      this.$confirm('是否确认删除选中的数据项?')
        .then(function () {
      
          return delCCalendar(Ids);
        })
        .then(() => {
      
          this.getDownList() ;
          this.getDetailList() ;
          this.getFlightData() ;
          this.msgSuccess("删除成功");
        })
        .catch(() => {
      });
    },
    //得到线体列表
    getLineList() {
      
      listBLineInfo(this.LineQueryParams).then((res) => {
      
        if (res.code == 200) {
      
          this.LineList = res.data.result
          
        }
      })
    },


    // //查看现有班次
    seeFlight() {
      
      this.seeNow = true

    },
    //得到存进去的日历数据
    getDownList() {
      
      listCCalendar(this.queryParams).then((res) => {
      
        if (res.code == 200) {
      
          this.downList = res.data.result
        }
      })
    },
//根据日期查列表
    getDetailList() {
      
   var a = JSON.parse(JSON.stringify(this.selectedDates))
   let c = a.join(",")
   
      getDetail({
      AttendanceDate : c }).then((res) => {
      
        if (res.code == 200) {
      
          this.detailList = res.data
       
    
        }
      })
    },
  //  得到排班的日期

    getFlightData() {
      
   
     let b = '000004' ;
     let a = '000003' ;
      getAttendanceData({
       flightNo: b }).then((res) => {
      
        if (res.code == 200) {
      
          this.FlightData = res.data

          for (let i = 0; i < this.FlightData.length; i++) {
      
            this.arr.push(this.FlightData[i].attendanceDate)
          }

          for (let i = 0; i < this.res.length; i++) {
      
            for (let j = 0; j < this.res[i].length; j++) {
      
              if (this.arr.includes(this.res[i][j].date)) {
      
                this.res[i][j].isSele = true
              }
            }
          }
        }
      })

      getAttendanceData({
       flightNo: a }).then((res) => {
      
        if (res.code == 200) {
      
          this.FlightData = res.data

          for (let i = 0; i < this.FlightData.length; i++) {
      
            this.arr.push(this.FlightData[i].attendanceDate)
          }

          for (let i = 0; i < this.res.length; i++) {
      
            for (let j = 0; j < this.res[i].length; j++) {
      
              if (this.arr.includes(this.res[i][j].date)) {
      
                this.res[i][j].isSele = true
              }
            }
          }
        }
      })
    },


    //切换滑动和点击
    TwoChange() {
      
      if ((this.selectedMode = this.selectMode === 'click')) {
      
        this.selectedMode = this.selectMode === 'move'
      }
      if ((this.selectedMode = this.selectMode === 'move')) {
      
        this.selectMode = 'click'
        this.selectedMode = this.selectMode === 'click'
      }
    },
    /** 添加出勤 */
    handleAdd() {
      
      var a = JSON.parse(JSON.stringify(this.selectedDates))
      var b = JSON.parse(JSON.stringify(this.form.flightNo))
      var c = JSON.parse(JSON.stringify(this.form.lineCode))
      // var a = JSON.parse(JSON.stringify(this.form.flightNo)) // 选中的日期数据
      // //var b = JSON.parse(JSON.stringify(this.form.flightNo)) // 表单的编号
      const mainTable = Object.assign({
      
        flightNo: b, //['1','2']
        attendanceDate: a, //[{}]
        lineCode: c,
        createBy: null,
        createTime: null,
        updateBy: null,
        upadteTime: null,
        isAttendance: 1,
      })

      addCCalendar(mainTable)
        .then((res) => {
      
          this.msgSuccess('添加成功')
        })

        .catch((err) => {
      
          //TODO 错误逻辑
        })
    },
    //班次列表查询
    getFlightList() {
      
      GetBFlightAll().then((res) => {
      
        if (res.code == 200) {
      
          this.flightList = res.data
          this.glFlightList = this.flightList.filter((x) => x.status == 0)

          for (let i = 0; i < this.glFlightList.length; i++) {
      
            this.arrFlightCode.push(this.glFlightList[i].flightCode)
          }
         
          for (let i = 0; i < this.flightList.length; i++) {
      
           
          }
        }
      })
    },
    handleGetDays(year, month, startOfWeek) {
      
      this.showDays = []
      this.days = getDaysInMonth(year, month)
      let firstDayOfWeek = new Date(`${
        year}-${
        month + 1}-01`).getDay()

      // 处理周起始日
      const obj = {
      
        1: '周一',
        2: '周二',
        3: '周三',
        4: '周四',
        5: '周五',
        6: '周六',
        0: '周日',
      }
      const firstDayInCN = obj[firstDayOfWeek]
      const index = this.weeks.indexOf(firstDayInCN)

      if (firstDayOfWeek === 0) {
      
        // 星期天为0 星期一为1 ,以此类推
        firstDayOfWeek = 7
      }

      this.prevDays = handleCrateDate(year, month, 1, index + 1, 'prev')
      this.rearDays = handleCrateDate(year, month, 1, 42 - this.days - index, 'rear')

      this.curDays = handleCrateDate(year, month, 1, this.days)
      this.showDays.unshift(...this.prevDays)
      this.showDays.push(...this.curDays)
      this.showDays.push(...this.rearDays)
      this.res = this.handleFormatDates(this.showDays)
    },
    handleFormatDates(arr, size = 7) {
      
      // 传入长度42的原数组,最终转换成二维数组
      const arr2 = []
      for (let i = 0; i < size; i++) {
      
        const temp = arr.slice(i * size, i * size + size)
        arr2.push(temp)
      }

      return arr2
    },
    handleTableHead(start) {
      
      const sliceDates = this.weeks.splice(start - 1)
      this.weeks.unshift(...sliceDates)
    },
    handleItemClick(item, i, j) {
      
      // if (!this.canSelect )
      //  {
      
      //    return
      // }

      if (this.selectedMode) {
      
        this.$nextTick(() => {
      
          // this.$set(this.res[i][j], 'isSelected', )
          this.res[i][j].isSelected = !this.res[i][j].isSelected
          if (this.res[i][j].isSelected) {
      
            this.selectedDates.push(this.res[i][j].date)
            this.selectedDates = Array.from(new Set(this.selectedDates))
            var a = JSON.parse(JSON.stringify(this.selectedDates))
            var b = JSON.parse(JSON.stringify(this.form.flightNo))
            var c = JSON.parse(JSON.stringify(this.form.lineCode))
            //item.isSee = true
            console.log(a, '这个是日期数组', b, '这个是班次编号', c, '线体编号')
            this.getDetailList();
          } else {
      
            this.selectedDates.splice(this.selectedDates.indexOf(item.date), 1)
          }
          this.$emit('dateSelected', this.selectedDates)
        })
      } else {
      
        // 滑动模式下,第一次点击是起始,第二次点击是结束
        const index = i * 7 + j
        this.canMove = true
        if (this.moveIndex.length === 1) {
      
          this.canMove = false
        }
        if (this.moveIndex.length === 2) {
      
          this.showDays.forEach((item) => {
      
            item.isSelected = false
            item.isRangeSelected = false
          })
          this.canMove = true
          this.moveIndex.length = 0
        }
        this.moveIndex.push(index)
        this.moveIndex.sort((a, b) => a - b)
        this.selectedDates = this.showDays.slice(this.moveIndex[0], this.moveIndex[1] + 1)
        this.selectedDates = Array.from(new Set(this.selectedDates))
        this.selectedDates.length !== 0 && this.$emit('dateSelected', this.selectedDates)
      }
    },
    handleItemMove(data, i, j) {
      
      if (this.canMove && !this.selectedMode) {
      
        const index = i * 7 + j
        this.showDays.forEach((item) => {
      
          item.isSelected = false
          item.isRangeSelected = false
        })
        // 让第一个日期和最后一个日期显示蓝色高亮
        this.showDays[index].isSelected = true
        this.showDays[this.moveIndex[0]].isSelected = true

        // 不同情况的判断,当用户的鼠标滑动进日期的索引小于起始日期的索引,要做if else处理
        if (this.moveIndex[0] < index) {
      
          for (let i = this.moveIndex[0] + 1; i < index; i++) {
      
            this.showDays[i].isRangeSelected = true
          }
        } else {
      
          for (let i = index + 1; i < this.moveIndex[0]; i++) {
      
            this.showDays[i].isRangeSelected = true
          }
        }
      }
    },
    handleQuickChange(type) {
      
      if (type === 'prev') {
      
        this.curMonth--
        console.log(this.curMonth)
        if (this.curMonth === -1) {
      
          this.curMonth = 11
          this.curYear -= 1
        }
      } else if (type === 'next') {
      
        this.curMonth++
        if (this.curMonth === 12) {
      
          this.curMonth = 0
          this.curYear += 1
        }
      }
    },
   //  颜色样式 // 遍历班次信息
    // tableRowClassName({ row, rowIndex }) {
      
    // for(let i = 0 ; i < this.glFlightList.length ; i++)
    // { 
    //    var matchColor = this.flightList[i].color 
    //   if (row.flightNo.indexOf(this.flightList[i].flightCode) != -1) {
      
    //     return 'box'
    //   }
    //   debugger
    //   var box=this.$el.getElementByClassName('box'); 
    //   box.style.backgroundColor= matchColor;
    // }

    // },
   
      /** 删除按钮操作 */
      deletes() {
      
      this.$confirm('是否确认删除选中的班次?')
        .then(function () {
      
          return DeleteFlightNo( {
      flightNo : '000003'})
        })
        .then(() => {
      
          this.getDownList() ;
          this.msgSuccess("删除成功");

        })
        .catch(() => {
      });
    },
    
  },
}
</script>

<style scoped lang="scss">
.calendar {
      
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.calendar-table {
      
  table-layout: fixed;
  border-collapse: collapse;
  transition: 0.3s;
  thead tr {
      
    height: 50px;
  }
  tbody tr {
      
    &:first-child td {
      
      border-top: 1px solid #82c0f3;
    }
    td {
      
      cursor: pointer;
      border-right: 1px solid #82c0f3;
      border-bottom: 1px solid #82c0f3;
      &:first-child {
      
        border-left: 1px solid #82c0f3;
      }
    }
  }
}

.notCurMonth {
      
  color: #c0c4cc;
}
.currentDay {
      
  color: #fff;
  background-color: #82c0f3;
}
.selectDay {
      
  color: #fff;
  background-color: #409eff;
}
.rangeSelectd {
      
  color: #606266;
  background-color: #dee2e9;
}
.weekend {
      
  color: #f73131;
}
.seeNow {
      
  color: #fff;
  background-color: rgba(103, 194, 58, 1);
}
button.el-button.el-button--danger.el-button--default {
      
    margin-left: -44px;



}
    

.box{
         
            background-color: red;
        }
</style>



版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_46087919/article/details/128930870

智能推荐

攻防世界_难度8_happy_puzzle_攻防世界困难模式攻略图文-程序员宅基地

文章浏览阅读645次。这个肯定是末尾的IDAT了,因为IDAT必须要满了才会开始一下个IDAT,这个明显就是末尾的IDAT了。,对应下面的create_head()代码。,对应下面的create_tail()代码。不要考虑爆破,我已经试了一下,太多情况了。题目来源:UNCTF。_攻防世界困难模式攻略图文

达梦数据库的导出(备份)、导入_达梦数据库导入导出-程序员宅基地

文章浏览阅读2.9k次,点赞3次,收藏10次。偶尔会用到,记录、分享。1. 数据库导出1.1 切换到dmdba用户su - dmdba1.2 进入达梦数据库安装路径的bin目录,执行导库操作  导出语句:./dexp cwy_init/[email protected]:5236 file=cwy_init.dmp log=cwy_init_exp.log 注释:   cwy_init/init_123..._达梦数据库导入导出

js引入kindeditor富文本编辑器的使用_kindeditor.js-程序员宅基地

文章浏览阅读1.9k次。1. 在官网上下载KindEditor文件,可以删掉不需要要到的jsp,asp,asp.net和php文件夹。接着把文件夹放到项目文件目录下。2. 修改html文件,在页面引入js文件:<script type="text/javascript" src="./kindeditor/kindeditor-all.js"></script><script type="text/javascript" src="./kindeditor/lang/zh-CN.js"_kindeditor.js

STM32学习过程记录11——基于STM32G431CBU6硬件SPI+DMA的高效WS2812B控制方法-程序员宅基地

文章浏览阅读2.3k次,点赞6次,收藏14次。SPI的详情简介不必赘述。假设我们通过SPI发送0xAA,我们的数据线就会变为10101010,通过修改不同的内容,即可修改SPI中0和1的持续时间。比如0xF0即为前半周期为高电平,后半周期为低电平的状态。在SPI的通信模式中,CPHA配置会影响该实验,下图展示了不同采样位置的SPI时序图[1]。CPOL = 0,CPHA = 1:CLK空闲状态 = 低电平,数据在下降沿采样,并在上升沿移出CPOL = 0,CPHA = 0:CLK空闲状态 = 低电平,数据在上升沿采样,并在下降沿移出。_stm32g431cbu6

计算机网络-数据链路层_接收方收到链路层数据后,使用crc检验后,余数为0,说明链路层的传输时可靠传输-程序员宅基地

文章浏览阅读1.2k次,点赞2次,收藏8次。数据链路层习题自测问题1.数据链路(即逻辑链路)与链路(即物理链路)有何区别?“电路接通了”与”数据链路接通了”的区别何在?2.数据链路层中的链路控制包括哪些功能?试讨论数据链路层做成可靠的链路层有哪些优点和缺点。3.网络适配器的作用是什么?网络适配器工作在哪一层?4.数据链路层的三个基本问题(帧定界、透明传输和差错检测)为什么都必须加以解决?5.如果在数据链路层不进行帧定界,会发生什么问题?6.PPP协议的主要特点是什么?为什么PPP不使用帧的编号?PPP适用于什么情况?为什么PPP协议不_接收方收到链路层数据后,使用crc检验后,余数为0,说明链路层的传输时可靠传输

软件测试工程师移民加拿大_无证移民,未受过软件工程师的教育(第1部分)-程序员宅基地

文章浏览阅读587次。软件测试工程师移民加拿大 无证移民,未受过软件工程师的教育(第1部分) (Undocumented Immigrant With No Education to Software Engineer(Part 1))Before I start, I want you to please bear with me on the way I write, I have very little gen...

随便推点

Thinkpad X250 secure boot failed 启动失败问题解决_安装完系统提示secureboot failure-程序员宅基地

文章浏览阅读304次。Thinkpad X250笔记本电脑,装的是FreeBSD,进入BIOS修改虚拟化配置(其后可能是误设置了安全开机),保存退出后系统无法启动,显示:secure boot failed ,把自己惊出一身冷汗,因为这台笔记本刚好还没开始做备份.....根据错误提示,到bios里面去找相关配置,在Security里面找到了Secure Boot选项,发现果然被设置为Enabled,将其修改为Disabled ,再开机,终于正常启动了。_安装完系统提示secureboot failure

C++如何做字符串分割(5种方法)_c++ 字符串分割-程序员宅基地

文章浏览阅读10w+次,点赞93次,收藏352次。1、用strtok函数进行字符串分割原型: char *strtok(char *str, const char *delim);功能:分解字符串为一组字符串。参数说明:str为要分解的字符串,delim为分隔符字符串。返回值:从str开头开始的一个个被分割的串。当没有被分割的串时则返回NULL。其它:strtok函数线程不安全,可以使用strtok_r替代。示例://借助strtok实现split#include <string.h>#include <stdio.h&_c++ 字符串分割

2013第四届蓝桥杯 C/C++本科A组 真题答案解析_2013年第四届c a组蓝桥杯省赛真题解答-程序员宅基地

文章浏览阅读2.3k次。1 .高斯日记 大数学家高斯有个好习惯:无论如何都要记日记。他的日记有个与众不同的地方,他从不注明年月日,而是用一个整数代替,比如:4210后来人们知道,那个整数就是日期,它表示那一天是高斯出生后的第几天。这或许也是个好习惯,它时时刻刻提醒着主人:日子又过去一天,还有多少时光可以用于浪费呢?高斯出生于:1777年4月30日。在高斯发现的一个重要定理的日记_2013年第四届c a组蓝桥杯省赛真题解答

基于供需算法优化的核极限学习机(KELM)分类算法-程序员宅基地

文章浏览阅读851次,点赞17次,收藏22次。摘要:本文利用供需算法对核极限学习机(KELM)进行优化,并用于分类。

metasploitable2渗透测试_metasploitable2怎么进入-程序员宅基地

文章浏览阅读1.1k次。一、系统弱密码登录1、在kali上执行命令行telnet 192.168.26.1292、Login和password都输入msfadmin3、登录成功,进入系统4、测试如下:二、MySQL弱密码登录:1、在kali上执行mysql –h 192.168.26.129 –u root2、登录成功,进入MySQL系统3、测试效果:三、PostgreSQL弱密码登录1、在Kali上执行psql -h 192.168.26.129 –U post..._metasploitable2怎么进入

Python学习之路:从入门到精通的指南_python人工智能开发从入门到精通pdf-程序员宅基地

文章浏览阅读257次。本文将为初学者提供Python学习的详细指南,从Python的历史、基础语法和数据类型到面向对象编程、模块和库的使用。通过本文,您将能够掌握Python编程的核心概念,为今后的编程学习和实践打下坚实基础。_python人工智能开发从入门到精通pdf

推荐文章

热门文章

相关标签